Friday, 6 September 2013

Why does this getter inside a function produce a syntax error?

Why does this getter inside a function produce a syntax error?

In Dart Editor build 27025, the following code produces a syntax error on
the line declaring the getter get x:
main() {
var _x;
set x(int x) => _x = x; // This is okay
get x => _x; // Syntax error here
}
Note that the setter set x doesn't produce an error. Is this a bug in Dart
Editor or am I doing something wrong here?

No comments:

Post a Comment