颤振生成命令不起作用收到错误

时间:2020-04-14 17:18:54

标签: flutter build

我在flutter中运行此命令:“ flutter pub run build_runner watch”它仅在一个项目中发生,并且一切正常

错误:

../../flutter-dart/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.1.0/lib/src/multi_headers.dart:97:8: Error: The method 'MultiHeaders.add' has fewer named arguments tha
n those of overridden method 'HttpHeaders.add'.
  void add(String name, Object value) {
       ^
org-dartlang-sdk:///sdk/lib/_http/http.dart:694:8: Context: This is the overridden method ('add').
  void add(String name, Object value,
       ^
../../flutter-dart/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.1.0/lib/src/multi_headers.dart:129:8: Error: The method 'MultiHeaders.set' has fewer named arguments th
an those of overridden method 'HttpHeaders.set'.
  void set(String name, Object value) {
       ^
org-dartlang-sdk:///sdk/lib/_http/http.dart:703:8: Context: This is the overridden method ('set').
  void set(String name, Object value,
       ^
pub finished with exit code 1

3 个答案:

答案 0 :(得分:6)

我想您已将flutter升级到了最新版本。您应该运行以下命令,并在pubspec.yaml的最新写入时间build_runner中检查1.8.1文件。 1}},您可以检查最新版本here

flutter pub upgrade

答案 1 :(得分:0)

您应该运行flutter pub升级...它需要升级您的pub文件

答案 2 :(得分:0)

如果不想更新所有软件包来解决此问题,请将其添加到软件包的pubspec.yaml文件中:

dependencies:
  http_multi_server: ^2.2.0

这只会升级http_multi_server