skip to Main Content

I havent touched Flutter for few months and now my old project wont run. I tried Pub get- Pub upgrade- outdated etc.

Flutter clean didn’t work and Flutter doctor looks good

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.4/lib/get_navigation/src/root/get_material_app.dart:297:15: Error: No named parameter with the name 'scrollBehavior'.
              scrollBehavior: scrollBehavior,
              ^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/app.dart:217:9: Context: Found this candidate, but the arguments don't match.
  const MaterialApp.router({
        ^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.4/lib/get_navigation/src/root/get_material_app.dart:340:15: Error: No named parameter with the name 'scrollBehavior'.
              scrollBehavior: scrollBehavior,
              ^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/app.dart:167:9: Context: Found this candidate, but the arguments don't match.
  const MaterialApp({
        ^^^^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'C:flutterpackagesflutter_toolsgradleflutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:flutterbinflutter.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

BU?LD FAILED in 17s
Exception: Gradle task assembleDebug failed with exit code 1

4

Answers


  1. You can run flutter upgrade to update new flutter to be compatible with GetX.

    Login or Signup to reply.
  2. Just open C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.4/lib/get_navigation/src/root/get_material_app.dart file, and then delete all parameters with the name scrollBehavior.
    This is how my problem was solved!

    Login or Signup to reply.
  3. You are using get package latest version, but your flutter sdk version is old. so you need to update your flutter sdk. I resolved by updating flutter sdk to latest version. Basically getX is mapping GetMaterialApp.route() parameters with MaterialApp.route() parameters but sdk you have used is not latest one so MaterialApp.route() not contains the this.scrollBehavior parameter and getX is not able to map it.
    You can resolve issue by two way.

    1. You need to install latest flutter sdk.
    2. You need to downgrade getX package.

    enter image description here

    Login or Signup to reply.
  4. Step1: Open pubspec.yaml file and remove the "get" dependency.

    Step2: Delete the pubspec.lock file.

    Step3: Again Open pubspec.yaml file and manually add get: 4.6.1 (remember GetX’s latest compatible version with Flutter 2.10.5 is 4.6.1. So for applying this version without ^.)(remove ˆ)
    getxversionproblem

    Step4: Then just GetPackages not UpgradePackages.

    all done now

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search