provide_deprecation_message
@Deprecated("message")
を使用して、非推奨メッセージを指定します。
このルールは、Dart 2.2 から利用可能です。
詳細
#必ず、Deprecated
コンストラクタで(移行手順や削除スケジュールを含む)非推奨メッセージを指定してください。
悪い例
dart
@deprecated
void oldFunction(arg1, arg2) {}
良い例
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) {}
使用方法
#provide_deprecation_message
ルールを有効にするには、analysis_options.yaml
ファイルのlinter > rules セクションに provide_deprecation_message
を追加します。
analysis_options.yaml
yaml
linter:
rules:
- provide_deprecation_message
特に明記されていない限り、このサイトのドキュメントは Dart 3.5.3 を反映しています。 ページ最終更新日: 2024年7月3日。 ソースを表示 または 問題を報告する.