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) {}
Was this page's content helpful?
除非另有说明,文档之所提及适用于 Dart 3.11.0 版本报告页面问题.