W33baker
W33baker

Reputation: 61

Flutter app won`t run Build. It failed with an exception after installing new updates

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

Upvotes: 1

Views: 1025

Answers (4)

Ripon Zaman
Ripon Zaman

Reputation: 1

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

Upvotes: 0

chetan
chetan

Reputation: 132

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

Upvotes: 0

ErfanRahmati
ErfanRahmati

Reputation: 93

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!

Upvotes: 0

Tuan Nguyen Minh
Tuan Nguyen Minh

Reputation: 26

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

Upvotes: 1

Related Questions