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;
Unless stated otherwise, the documentation on this site reflects Dart 3.12.2. Report an issue.