dio icon indicating copy to clipboard operation
dio copied to clipboard

The method 'DioHttpHeaders.add' has fewer named arguments than those of overridden method 'HttpHeaders.add'.

Open benoittachet opened this issue 6 years ago • 12 comments

New Issue Checklist

I have searched a similar issue, and found only a closed one, so I preferred to start a new one

Platform Name - Flutter Platform Version - Flutter 1.17.0 Dio Version - Tested with 2.0.22 and 3.0.9 Android Studio Version - Tested with 3.5.1 and 3.5.3 Repro rate - 100% Repro with demo proj : Cannot launch Demo proj, but from a different error Demo Project Link : https://drive.google.com/file/d/1PO88kXPPSi_mY5wGJJW6NRq-AfLYqI-p/view?usp=sharing

Issue Description and Steps

In Dio Example, the following error pops, cannot test for mine D:\downloads\dio-3.0.9\example\flutter_example\android\app\src\debug\AndroidManifest.xml Error:

	Overlay manifest:package attribute declared at AndroidManifest.xml:2:5-48 value=(club.flutterchina.flutter_example)
	has a different value=(club.flutterchina.flutterexample) declared in main manifest at AndroidManifest.xml:2:5-47
	Suggestion: remove the overlay declaration at AndroidManifest.xml 	and place it in the build.gradle:
		flavorName {
			applicationId = "club.flutterchina.flutter_example"
		} 

In my program (Demo Project), following error pops :

Compiler message:

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.2.2/lib/src/dio_http_headers.dart:55:8: Error: The method 'DioHttpHeaders.add' has fewer named arguments than those of overridden method 'HttpHeaders.add'.
  void add(String name, value) {
       ^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:694:8: Context: This is the overridden method ('add').
  void add(String name, Object value,
       ^

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.2.2/lib/src/dio_http_headers.dart:70:8: Error: The method 'DioHttpHeaders.set' has fewer named arguments than those of overridden method 'HttpHeaders.set'. void set(String name, Object value) { ^ org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:703:8: Context: This is the overridden method ('set'). void set(String name, Object value, ^

benoittachet avatar May 11 '20 18:05 benoittachet

I also meet this problem. Flutter: 1.17.0 Dio: 2.2.2 Xcode 11.4.1 💦


Updating Dio to 3.0.9 and Dart to 2.8.1(stable) solved this problem. Of course, don't forget to modify your code to clean build error. And then, you can run flutter build xxxx.

ZeroOnet avatar May 12 '20 09:05 ZeroOnet

Updating the version to 3.0.9 solved the problem.

Hejianghao avatar May 13 '20 04:05 Hejianghao

when we use dio:2.1.13. Compiler message: ../../../SoftwareInstalled/flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.1.13/lib/src/dio_http_headers.dart:55:8: Error: The method 'DioHttpHeaders.add' has fewer named arguments than those of overridden method 'HttpHeaders.add'. void add(String name, value) { ^ org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:694:8: Context: This is the overridden method ('add'). void add(String name, Object value, ^ ../../../SoftwareInstalled/flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.1.13/lib/src/dio_http_headers.dart:70:8: Error: The method 'DioHttpHeaders.set' has fewer named arguments than those of overridden method 'HttpHeaders.set'. void set(String name, Object value) { ^ org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:703:8: Context: This is the overridden method ('set'). void set(String name, Object value,

rahul-rahul1 avatar Jun 09 '20 05:06 rahul-rahul1

Updating the version to 3.0.9. This worked for me.

TahaAli07 avatar Jun 12 '20 13:06 TahaAli07

Updating the version to 3.0.9. This worked for me.

what version 3.0.9 please help me ----- this is latest issue

/B:/flutter_windows_1.17.3-stable/flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.2.2/lib/src/dio_http_headers.dart:70:8: Error: The method 'DioHttpHeaders.set' has fewer named arguments than those of overridden method 'HttpHeaders.set'. void set(String name, Object value) {

devendra1988 avatar Jun 19 '20 06:06 devendra1988

@devendra1988 In your pubspec.yaml , update the version of dio package to 3.0.9

TahaAli07 avatar Jun 19 '20 09:06 TahaAli07

Tha ks dear

On Fri, Jun 19, 2020, 2:56 PM Taha Ali [email protected] wrote:

@devendra1988 https://github.com/devendra1988 In your pubspec.yaml , update the version of dio package to 3.0.9

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/flutterchina/dio/issues/780#issuecomment-646534125, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGC6VAWILGHRDJLQKNLQKW3RXMVLZANCNFSM4M6EBTLA .

devendra1988 avatar Jun 19 '20 10:06 devendra1988

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

stale[bot] avatar Jul 19 '20 10:07 stale[bot]

Hello, I used this sample and I got the following error message I used the dio: ^ 3.0.10 Could you help me please Thank you

lib / main.dart: 66: 45: Error: Method not found: 'uploadFileInfo'. new FormData.fromMap ({"file": new uploadFileInfo (filePath, fileName)});

Carle2 avatar Mar 10 '21 16:03 Carle2

Hi, I meet the same problem Flutter 2.0.2 Dart 2.12.1 Dio 2.2.2 (I tried also with oldest version of Flutter/Dart/Dio ) can someone help me, please

rafaelventura204 avatar Apr 04 '21 23:04 rafaelventura204

i have the same issues

hussamDana92 avatar Apr 22 '21 07:04 hussamDana92

../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.2.2/lib/src/dio_http_headers.dart:55:8: Error: The method 'DioHttpHeaders.add' has fewer named arguments than those of overridden method 'HttpHeaders.add'.
  void add(String name, value) {
       ^
org-dartlang-sdk:///dart-sdk/lib/_http/http.dart: Context: This is the overridden method ('add').

../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.2.2/lib/src/dio_http_headers.dart:70:8: Error: The method 'DioHttpHeaders.set' has fewer named arguments than those of overridden method 'HttpHeaders.set'.
  void set(String name, Object value) {
       ^
org-dartlang-sdk:///dart-sdk/lib/_http/http.dart: Context: This is the overridden method ('set').

Same here. Fresh flutter, fresh dio. Reopen this issue please

Gradergage avatar Apr 26 '21 00:04 Gradergage