invalid_ deprecated_ extend_ annotation
The annotation '@Deprecated.extend' can only be applied to extendable classes.
Description
#
The analyzer produces this diagnostic when anything other than an
extendable class is annotated with
Deprecated.extend. An extendable class is a
class not declared with the
interface
,
final
, or
sealed
keywords,
and with at least one public generative constructor.
Example
#The following code produces this diagnostic because the annotation is on a sealed class:
@Deprecated.extend()
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-1. View source or report an issue.