invalid_ reopen_ annotation
Details about the 'invalid_reopen_annotation' diagnostic produced by the Dart analyzer.
The annotation '@reopen' can only be applied to a class that opens capabilities that the supertype intentionally disallows.
Description
#
The analyzer produces this diagnostic when a @reopen annotation has been
placed on a class or mixin that does not remove restrictions placed on the
superclass.
Example
#
The following code produces this diagnostic because the class B is
annotated with @reopen even though it doesn't expand the ability of A
to be subclassed:
import 'package:meta/meta.dart';
sealed class A {}
@reopen
class B extends A {}
Common fixes
#If the superclass should be restricted in a way that the subclass would change, then modify the superclass to reflect those restrictions:
import 'package:meta/meta.dart';
interface class A {}
@reopen
class B extends A {}
If the superclass is correct, then remove the annotation:
sealed class A {}
class B extends A {}
Unless stated otherwise, the documentation on this site reflects Dart 3.10.3. Report an issue.