1

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:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991

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

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

4
  • It looks like scrollBehavior is no longer required with your current version of Flutter. Try removing it and run the app again. It should work Commented Aug 1, 2021 at 2:47
  • @zeeshanahmad theres no scrollBehavior in my codes. It also looks like MaterialApp cant be found but i have no idea why Commented Aug 2, 2021 at 1:00
  • Please share your app.dart code so I can take a look. Commented Aug 2, 2021 at 2:11
  • @zeeshanahmad I dont have a file called app.dart My main.dart where it has MaterialApp function only has 93 lines as well Commented Aug 3, 2021 at 10:30

4 Answers 4

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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!

Comments

0

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.