Dart 在变量上运行()

Dart 在变量上运行(),dart,Dart,有点被d()搞糊涂了符号。。。 这是一种语义上的舒格吗?d()的含义应为call(),如ReactionDisposer类中所述。即应该有d.call()它是否具有相同的含义 void dispose() { for (final d in _disposers) { // a list of type ReactionDisposer d(); // what is it? } } class ReactionDisposer { ReactionDisp

有点被
d()搞糊涂了符号。。。
这是一种语义上的舒格吗?
d()的含义
应为
call()
,如
ReactionDisposer
类中所述。即应该有
d.call()它是否具有相同的含义

void dispose() {
    for (final d in _disposers) { // a list of type ReactionDisposer
      d(); // what is it?
    }
  }

class ReactionDisposer {
  ReactionDisposer(this.reaction);

  final Reaction reaction;

  /// Invoking it will dispose the underlying [reaction]
  void call() => reaction.dispose();
}

在Dart中,如果对象实现了方法
call()
,则可以像使用方法/函数一样使用对象

So
d()
将执行
ReactionDisposer
中定义的
call()
方法

您可以在Dart Langauge教程中了解这一点: