我已经有几个月没有接触Flutter了,现在我的旧项目不能运行了。我尝试了Pub get- Pub升级-过时等。
颤动清洁不起作用,扑动医生看起来很好
/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发布于 2021-08-03 07:32:54
可以运行flutter upgrade来更新新的颤振以与GetX兼容。
发布于 2021-08-10 07:10:47
只需打开C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.4/lib/get_navigation/src/root/get_material_app.dart文件,然后删除所有名为scrollBehavior的参数。这就是我的问题是如何解决的!
发布于 2021-08-15 10:12:09
您使用的是get package最新版本,但flutter sdk版本较旧。所以你需要更新你的flutter sdk。我通过将flutter sdk更新到最新版本来解决这个问题。基本上,getX将GetMaterialApp.route()参数与MaterialApp.route()参数进行映射,但是您使用的sdk不是最新的,因此MaterialApp.route()不包含this.scrollBehavior参数,并且getX无法映射它。您可以通过两种方式来解决问题。

https://stackoverflow.com/questions/68606704
复制相似问题