unused_element_parameter
A value for optional parameter '{0}' isn't ever given.
Description
#The analyzer produces this diagnostic when a value is never passed for an optional parameter declared within a private declaration.
Example
#Assuming that no code in the library passes a value for y
in any invocation of _m
, the following code produces this diagnostic:
dart
class C {
void _m(int x, [int? y]) {}
void n() => _m(0);
}
Common fixes
#If the declaration isn't needed, then remove it:
dart
class C {
void _m(int x) {}
void n() => _m(0);
}
If the declaration is intended to be used, then add the code to use it.
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.