0

当我尝试使用 Get 运行颤振应用程序时出现错误:

Running Gradle task 'assembleDebug'...
../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/root/get_cupertino_app.dart:252:17: Error: No named parameter with the name 'useInheritedMediaQuery'.
                useInheritedMediaQuery: useInheritedMediaQuery,
                ^^^^^^^^^^^^^^^^^^^^^^
/E:/fluttersdk/flutter/packages/flutter/lib/src/cupertino/app.dart:188:9: Context: Found this candidate, but the arguments don't match.
  const CupertinoApp.router({
        ^^^^^^^^^^^^^^^^^^^
../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/root/get_cupertino_app.dart:292:17: Error: No named parameter with the name 'useInheritedMediaQuery'.
                useInheritedMediaQuery: useInheritedMediaQuery,
                ^^^^^^^^^^^^^^^^^^^^^^
E:/fluttersdk/flutter/packages/flutter/lib/src/cupertino/app.dart:144:9: Context: Found this candidate, but the arguments don't match.
  const CupertinoApp({
        ^^^^^^^^^^^^
../AppData/Local/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,
                ^^^^^^^^^^^^^^^^^^^^^^
/E:/fluttersdk/flutter/packages/flutter/lib/src/material/app.dart:219:9: Context: Found this candidate, but the arguments don't match.
  const MaterialApp.router({
        ^^^^^^^^^^^^^^^^^^
../AppData/Local/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,
                ^^^^^^^^^^^^^^^^^^^^^^
/E:/fluttersdk/flutter/packages/flutter/lib/src/material/app.dart:168:9: Context: Found this candidate, but the arguments don't match.
  const MaterialApp({
        ^^^^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'E:\fluttersdk\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1052

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'E:\fluttersdk\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
Exception: Gradle task assembleDebug failed with exit code 1

有谁知道如何解决这一问题?我查看了类似的主题并尝试了他们的提示 - 没有任何帮助。使用 GetMaterialApp 包装的主要小部件:

void main() => runApp(GetMaterialApp(home: MainScreen()));
4

2 回答 2

1

我有同样的问题。我通过将 GetX 版本减少为:

#In pubspec.yaml use get package like below :

get: 4.5.1

其他人尝试使用这种方式解决方案:(但这对我不起作用)

#In pubspec.yaml use get package like below :

get: 4.6.1
#remove ^ symbol
于 2022-02-10T04:16:03.307 回答
0

使用 Getx 最新版本:

dependencies:
  get: ^4.6.1
于 2022-02-01T15:34:39.083 回答