avoid_ final_ parameters
Details about the 'avoid_final_parameters' diagnostic produced by the Dart analyzer.
Parameters should not be marked as 'final'.
Description
#
The analyzer produces this diagnostic when a parameter declaration is
marked with the final keyword.
Examples
#
The following code produces this diagnostic because the
parameter a is marked as final:
void f(final String a) {
print(a);
}
The following code produces this diagnostic because the
closure parameter a is marked as final:
var f = (final int a) => print(a);
Common fixes
#Remove the final keyword from the parameter declaration:
void f(String a) {
print(a);
}
var f = (int a) => print(a);
Unless stated otherwise, the documentation on this site reflects Dart 3.11.0. Report an issue.