0
我注意到在某些类中有一个@运算符。@运算符的意义是什么?
例如,
@TestOn("!vm")
.....
当我挖进一步TestOn是一个类。
class TestOn {
/// The expression specifying the platform.
final String expression;
const TestOn(this.expression);
}
有人能告诉我@操作符有什么意义吗?
想一下你的答案:http://stackoverflow.com/questions/24111378/refer-classes-by-their-metadata-tag。我也很好奇。看起来你可以用另一个装饰课程,比如TS或带有注释的ES6。您似乎将const TestOn应用于上面的任何内容,这可能在(可能)测试/运行该函数时用作元数据。或类似的东西。类似于在TypeScript中的一个函数上面添加“@Component”,它给了它一个Component(这是一个类)的属性。谷歌确实喜欢他们的注释/装饰器。 –