http://radar.oreilly.com/2013/05/dart-is-not-the-language-you-think-it-is.html
有可能提出一个愚蠢的问题:我之前从未见过这种语法:
// Dart
class Point {
num x, y;
Point(this.x, this.y);
String toString() => 'X: $x, Y: $y';
}
是& gt表示引用?
import 'dart:mirrors';
class LoggingProxy {
InstanceMirror mirror;
LoggingProxy(delegate)
: mirror = reflect(delegate);
noSuchMethod(Invocation invocation) {
var name = invocation.memberName;
print('${name} was called');
return mirror.delegate(invocation);
}
}
以及结肠是什么:
LoggingProxy(delegate)
: mirror = reflect(delegate);
在做什么?
答案 0 :(得分:1)
源代码由于某种原因已被转义:
String toString() => 'X: $x, Y: $y';
What do entities: < and > stand for?
函数体的简单=>
语法简写等于{return 'X: $x, Y: $y'; }
应改为String toString() => 'X: $x, Y: $y';
。
这是constructor's initializer list:
LoggingProxy(delegate)
: mirror = reflect(delegate);