provide_deprecation_message
Provide a deprecation message, via @Deprecated("message")
.
This rule is available as of Dart 2.2.
Rule sets: core, recommended, flutter
Details
#DO specify a deprecation message (with migration instructions and/or a
removal schedule) in the Deprecated
constructor.
BAD:
dart
@deprecated
void oldFunction(arg1, arg2) {}
GOOD:
dart
@Deprecated("""
[oldFunction] is being deprecated in favor of [newFunction] (with slightly
different parameters; see [newFunction] for more information). [oldFunction]
will be removed on or after the 4.0.0 release.
""")
void oldFunction(arg1, arg2) {}
Usage
#To enable the provide_deprecation_message
rule,
add provide_deprecation_message
under linter > rules in your
analysis_options.yaml
file:
analysis_options.yaml
yaml
linter:
rules:
- provide_deprecation_message
除非另有说明,文档之所提及适用于 Dart 3.5.3 版本,本页面最后更新时间: 2024-08-02。 查看文档源码 或者 报告页面问题。