invalid_ deprecated_ subclass_ annotation
The annotation '@Deprecated.subclass' can only be applied to subclassable classes and mixins.
Description
#
The analyzer produces this diagnostic when anything other than a
subclassable class or mixin is annotated with
Deprecated.subclass. A subclassable
class is a class not declared with the
final
or
sealed
keywords. A
subclassable mixin is a mixin not declared with the
base
keyword.
Example
#The following code produces this diagnostic because the annotation is on a sealed class:
@Deprecated.subclass()
sealed class C {}
Common fixes
#Remove the annotation:
sealed 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.