empty_container_bodies
Details about the 'empty_container_bodies' diagnostic produced by the Dart analyzer.
Empty {0} bodies should be written using a ';' rather than '{}'.
Description
#The analyzer produces this diagnostic when the block body of a class, enum, extension, extension type, or mixin is empty and can be replaced by a semicolon.
Example
#
The following code produces this diagnostic because the body of the class
C is empty:
class C {}
Common fixes
#If the class needs to have members, then add them:
class C {
String toString() => 'c';
}
Otherwise, replace the body with a semicolon:
class C;
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.