invalid_deprecated_instantiate_annotation
The annotation '@Deprecated.instantiate' can only be applied to classes.
Description
#The analyzer produces this diagnostic when anything other than an instantiable class is annotated with Deprecated.instantiate. An instantiable class is one not declared with the abstract
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.instantiate()
sealed class C {}
Common fixes
#Remove the annotation:
sealed class C {}
Unless stated otherwise, the documentation on this site reflects Dart 3.9.0. Page last updated on 2025-08-16. View source or report an issue.