Skip to main content

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:

dart
void f(dynamic p) {}

Common fixes

#

Remove the dynamic type annotation:

dart
void f(p) {}