invalid_ visible_ for_ overriding_ annotation
Details about the 'invalid_visible_for_overriding_annotation' diagnostic produced by the Dart analyzer.
The annotation 'visibleForOverriding' can only be applied to a public instance member that can be overridden.
Description
#
The analyzer produces this diagnostic when anything other than
a public instance member of a class is annotated with
visibleForOverriding. Because only public instance members can be overridden
outside the defining library, there's no value to annotating
any other declarations.
Example
#The following code produces this diagnostic because the annotation is on a class, and classes can't be overridden:
import 'package:meta/meta.dart';
@visibleForOverriding
class C {}
Common fixes
#Remove the annotation:
class C {}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.