我已经更新到最新的flutter更新。当我要启动项目时,它返回一个错误。该项目取决于多个存储库,我不知道这是为什么。我尝试了多种解决方案,但它们不能解决错误。希望可以有人帮帮我。谢谢。
编译器消息:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/mvvm-0.1.7/lib/view_context_helpers/logical.dart:151:25: Error: The function expression type 'Widget Function(BuildContext, Null, Widget) Function(TValue)' isn't of expected type 'Widget Function(BuildContext, TValue, Widget) Function(TValue)'.
- 'Widget' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
Change the type of the function expression or the context in which it is used.
selector: (TValue value) =>
^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 31s
Finished with error: Gradle task assembleDebug failed with exit code 1
答案 0 :(得分:1)
我发现了这个问题issue TL:DR,这里是摘要
您的本地引擎构建波动/引擎和框架+工具波动/波动似乎不同步:您使用的是SemanticsFlag.isLink
添加后的引擎,而之前是添加的框架/工具进入框架。
您需要确保使用兼容的引擎和框架。在这种情况下,您需要将颤振/颤振更新为新版本,或将颤振/引擎回滚为旧版本。42356
答案 1 :(得分:0)
Solution 1
1.Ensure compatible engines and frameworks.
2.Update flutter or install flutter to a newer version,
still issue persists, Roll back flutter or engine to an older version.
Best solution to fix by time saving but not preferable, please follow
Solution 2
1. Download latest version flutter sdk and setup.
2. Fix it by creating a new project and copying the code from the old one.
有关更多详细信息,请参见下面的链接
答案 2 :(得分:0)
由于插件/软件包不兼容,也会发生此错误。 pubsec.yaml文件中必须有一些软件包已升级到新版本,而您仍在使用旧版本/不推荐使用的方法。
因此,您需要用new替换所有不赞成使用的方法。