Error when starting flutter application with Get

502 Views Asked by At

I have error when i try to run flutter app using 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

Does anyone know how to fix this? I looked at similar topics and tried the tips from them - nothing helped. Main widget wrap with GetMaterialApp:

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

There are 2 best solutions below

0
On

Use Getx Latest Version :

dependencies:
  get: ^4.6.1
1
On

I hv same issue. I solved by reducing GetX version into :

#In pubspec.yaml use get package like below :

get: 4.5.1

Others try solution use this way: (But This doesn't work for me)

#In pubspec.yaml use get package like below :

get: 4.6.1
#remove ^ symbol