duplicate_named_argument
The argument for the named parameter '{0}' was already specified.
Description
#The analyzer produces this diagnostic when an invocation has two or more named arguments that have the same name.
Example
#The following code produces this diagnostic because there are two arguments with the name a
:
dart
void f(C c) {
c.m(a: 0, a: 1);
}
class C {
void m({int? a, int? b}) {}
}
Common fixes
#If one of the arguments should have a different name, then change the name:
dart
void f(C c) {
c.m(a: 0, b: 1);
}
class C {
void m({int? a, int? b}) {}
}
If one of the arguments is wrong, then remove it:
dart
void f(C c) {
c.m(a: 1);
}
class C {
void m({int? a, int? b}) {}
}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.