添加 get:^4.6.1 后,出現以下錯誤。
代碼:
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Flutter web One',
home: HomePage(),
);
}
}
錯誤:
const CupertinoApp({
^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/root/get_material_app.dart:275:17: Error: No named parameter with the name 'useInheritedMediaQuery'.
useInheritedMediaQuery: useInheritedMediaQuery,
^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/material/app.dart:217:9: Context: Found this candidate, but the arguments don't match.
const MaterialApp.router({
^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/root/get_material_app.dart:322:17: Error: No named parameter with the name 'useInheritedMediaQuery'.
useInheritedMediaQuery: useInheritedMediaQuery,
^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/material/app.dart:166:9: Context: Found this candidate, but the arguments don't match.
const MaterialApp({
^^^^^^^^^^^
而且,如果我嘗試將 getx 版本 4.6.1 降級到 4.3.8,我仍然遇到相同的錯誤,并且在錯誤中,它顯示get-4.6.1版本。
uj5u.com熱心網友回復:
上述問題發生在get版本>= 4.6.0。使用 4.6.0 以下的確切版本并使用 using^標志,將包升級到最大兼容版本。
正在pubspec.yaml使用的get包如下:
get: 4.5.1 #Don't use ^
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/402076.html
