remove_ deprecations_ in_ breaking_ versions
Details about the 'remove_deprecations_in_breaking_versions' diagnostic produced by the Dart analyzer.
Remove deprecated elements in breaking versions.
Description
#
The analyzer produces this diagnostic in packages that have a
"breaking" version number (x.0.0 or
0.x.0) for every declaration that has a
@Deprecated annotation.
Example
#
Given a package with a pubspec.yaml file
containing:
name: p
version: 2.0.0
environment:
sdk: ^3.9.0
The following code produces this diagnostic because the
function f is annotated with
@deprecated:
@Deprecated('...')
void f() {}
void g() {}
Common fixes
#If the declaration should be removed in the next release of the package, then remove the declaration:
void g() {}
If you are not making a breaking change, then use a minor or patch version increment for the package:
name: p
version: 1.0.1
environment:
sdk: ^3.9.0
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.