private_ named_ parameter_ duplicate_ public_ name
The corresponding public name '{0}' is already the name of another parameter.
Description
#
The analyzer produces this diagnostic when a private named parameter
(leading _) has a corresponding public name that conflicts with an
existing parameter name in the same parameter list.
Example
#
The following code produces this diagnostic because the private named
parameter _x's public name is x, which conflicts with the existing
parameter named x:
class C {
int? _x;
C({int? x, this._x});
int? get x => _x;
}
Common fixes
#Rename one of the two parameters.
Unless stated otherwise, the documentation on this site reflects Dart 3.10.3. Page last updated on 2025-12-5. View source or report an issue.