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