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);
除非另有说明,文档之所提及适用于 Dart 3.11.0 版本报告页面问题.