Flutter run 运行异常(与flutter star
版本有关):
Compiler message:
file:///usr/local/flutter1.5.4/.pub-cache/hosted/pub.flutter-io.cn/flustars-0.2.5/lib/src/widget_util.dart:88:8: Error: No named parameter with the name 'onError'.
}, onError: (dynamic exception, StackTrace stackTrace) {
^^^^^^^
file:///usr/local/flutter1.5.4/.pub-cache/hosted/pub.flutter-io.cn/flustars-0.2.5/lib/src/widget_util.dart:115:8: Error: No named parameter with the name 'onError'.
}, onError: (dynamic exception, StackTrace stackTrace) {
^^^^^^^
Compiler failed on /Users/yangjuanfang/git/dapp/lib/main.dart
FAILURE: Build failed with an exception.
* Where:
Script '/usr/local/flutter1.5.4/packages/flutter_tools/gradle/flutter.gradle' line: 665
* What went wrong:
Execution failed for task ':app:compileflutterBuildDebugX86'.
> Process 'command '/usr/local/flutter1.5.4/bin/flutter'' 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 24s
出错原因: 这个是因为你的flutter sdk版本 高于第三方库当时使用的版本,所以你需要到你的项目pubspec.yaml 更新第三方库的为最新的版本,例如改成flustars: ^0.2.6+1 。再运行项目就可以了,这个第三方库已经改过来了,如果没改过来就需要自己fork一份修改好再导入了。
—— @溪溪笑_806f
解决方法操作步骤:
1、在项目根目录/pubspec.yaml
中dependencies:
下添加flustars: ^0.2.6+1
# pubspec.yaml配置
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
flustars: ^0.2.6+1
...
2、终端执行flutter pub get
下载相关依赖
- TIPS:若发现下载过慢或失败,请参见《Flutter卡packages get解决方法(附默认插件地址及国内镜像修改)》
3、重新运行项目即可
若对你有帮助,请点个赞让我知道下,以后多更新异常问题及处理方案方便大家~
网友评论