它表示类,函数,属性等是deprecated
在Dart中,注释用于将某些内容标记为已弃用。请注意this class上记录的注释。
在Dart metadata中可以添加到类,字段,库声明,参数......作为注释。
@Deprecated('some reason')
class SomeClass {
String someField;
int otherField;
SomeClass({
this.someField,
@Deprecated('don\'t use this anymore") this.otherField});
}
是这样的注释,并且像Dart分析器和dartdoc这样的工具使用这些信息来产生警告(Analyzer)或其他视觉提示,某些API仍然存在但应该避免,因为它计划最终被删除。