dart api划掉了变量

问题描述 投票:2回答:2

在大多数Dart文档页面中,一些变量和函数被划掉。就像在https://api.dartlang.org/1.14.2/dart-js/dart-js-library.html

这意味着什么?

api sdk dart
2个回答
2
投票

它表示类,功能,属性等是deprecated

在Dart中,注释用于将某些内容标记为已弃用。请注意this class上记录的注释。


2
投票

在Dart中,metadata可以添加到类,字段,库声明,参数......作为注释。

@Deprecated('some reason')
class SomeClass {
  String someField;
  int otherField;

  SomeClass({
      this.someField, 
      @Deprecated('don\'t use this anymore") this.otherField});
}

是这样的注释和一些工具,如Dart分析器和dartdoc使用这些信息来产生警告(分析器)或其他视觉线索,一些API仍然存在但应该避免,因为它计划最终被删除。

© www.soinside.com 2019 - 2024. All rights reserved.