跳到主要內容

provide_deprecation_message

缺少棄用訊息。

描述

#

當使用 deprecated 註解而非 Deprecated 註解時,分析器會生成此診斷。

示例

#

以下程式碼產生此診斷,因為函式 f 使用了 deprecated 註解

dart
@deprecated
void f() {}

常見修復

#

將程式碼轉換為使用更長的形式

dart
@Deprecated('Use g instead. Will be removed in 4.0.0.')
void f() {}