invalid_ visible_ for_ overriding_ annotation
                  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 {}
                      
                      
                      
                    Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-4. View source or report an issue.