Search code examples
flutterbuild

flutter build command is not working getting error


i run this command in flutter: "flutter pub run build_runner watch" it is happening only in one project and rest all fine

error :

../../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

Solution

  • I guess you have upgraded flutter to the latest version.You should run the following command and also check pubspec.yaml file if build_runner is at the latest version, at this very writing time which is 1.8.1,you can check the latest version here.

    flutter pub upgrade