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:
class C {
void _m(int x, [int? y]) {}
void n() => _m(0);
}
Common fixes
#If the declaration isn't needed, then remove it:
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.
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.