avoid_ annotating_ with_ dynamic
Details about the 'avoid_annotating_with_dynamic' diagnostic produced by the Dart analyzer.
Unnecessary 'dynamic' type annotation.
Description
#
The analyzer produces this diagnostic when a parameter has an explicit
dynamic type annotation. Because dynamic is the default type for
parameters without a type annotation, the annotation is unnecessary.
Example
#
The following code produces this diagnostic because the parameter p
is explicitly annotated with dynamic:
void f(dynamic p) {}
Common fixes
#Remove the dynamic type annotation:
void f(p) {}
Unless stated otherwise, the documentation on this site reflects Dart 3.11.0. Report an issue.