Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
benoittachet opened this issue May 11, 2020 · 12 comments

Comments

@benoittachet
Copy link

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,
^

@ZeroOnet
Copy link

ZeroOnet commented May 12, 2020

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.

@Hejianghao
Copy link

Updating the version to 3.0.9 solved the problem.

@rahul-rahul1
Copy link

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,

@TahaAli07
Copy link

Updating the version to 3.0.9. This worked for me.

@devendra1988
Copy link

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) {

@TahaAli07
Copy link

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

@devendra1988
Copy link

devendra1988 commented Jun 19, 2020 via email

@stale
Copy link

stale bot commented Jul 19, 2020

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 stale bot added the stale label Jul 19, 2020
@stale stale bot closed this as completed Jul 26, 2020
@Carle2
Copy link

Carle2 commented Mar 10, 2021

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)});

@rafaelventura204
Copy link

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

@hussamDana92
Copy link

i have the same issues

@Gradergage
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants