deprecated_ extend
Extending '{0}' is deprecated.
Description
#
The analyzer produces this diagnostic when a class annotated with
@Deprecated.extend
is used in the
extends
clause of a class
declaration.
This annotation indicates that the ability for classes to extend the
annotated class is deprecated, and will soon be removed, perhaps by
marking the annotated class with
interface
,
final
, or
sealed
.
Example
#If the library p
defines a class annotated with @Deprecated.extend
:
@Deprecated.extend()
class C {}
Then, the following code, when in a library other than
p
, produces this
diagnostic:
import 'package:p/p.dart';
class D extends C {}
Common fixes
#
Follow any directions found in the
Deprecation.extend
annotation, or
just remove the
extends
clause.
class D {}
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.