Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart @operator的意义是什么?_Dart - Fatal编程技术网

Dart @operator的意义是什么?

Dart @operator的意义是什么?,dart,Dart,我注意到在一些类中有一个@operator 比如说, @TestOn("!vm") ..... 当我进一步挖掘时,TestOn是一个类 class TestOn { /// The expression specifying the platform. final String expression; const TestOn(this.expression); } 谁能告诉我@operator的意义是什么吗?@TestOn(“!vm”)是一个很好的例子。它们用于提供有关Dar

我注意到在一些类中有一个@operator

比如说,

@TestOn("!vm")
.....
当我进一步挖掘时,TestOn是一个类

class TestOn {
  /// The expression specifying the platform.
  final String expression;

  const TestOn(this.expression);
}
谁能告诉我@operator的意义是什么吗?

@TestOn(“!vm”)
是一个很好的例子。它们用于提供有关Dart程序中元素的额外信息。

@TestOn(“!vm”)
是一个。它们用于提供有关Dart程序中元素的额外信息。

想想你的答案:。我也很好奇。看起来您可以用另一个类来装饰一个类,如TS或ES6中的注释。您似乎正在将const TestOn应用于上面的任何内容,当(可能)测试/运行该函数时,它可能被用作元数据。或者类似的。类似于在TypeScript中的函数上方添加“@Component”,这将为其提供组件(类)的属性。Google确实喜欢他们的注释/装饰器。请相信下面是您的答案:。我也很好奇。看起来您可以用另一个类来装饰一个类,如TS或ES6中的注释。您似乎正在将const TestOn应用于上面的任何内容,当(可能)测试/运行该函数时,它可能被用作元数据。或者类似的。类似于在TypeScript中的函数上方添加“@Component”,这将为其提供组件(类)的属性。谷歌确实喜欢他们的注释/装饰。