Skip to content

Instantly share code, notes, and snippets.

@osa1
Created December 20, 2022 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osa1/a23ae7b3ed9800240644bb2392370ce7 to your computer and use it in GitHub Desktop.
Save osa1/a23ae7b3ed9800240644bb2392370ce7 to your computer and use it in GitHub Desktop.
Strange Dart 5
class C {
dynamic get a {
print('C.a getter called');
return (x) => print('C.a return value called');
}
}
void main() {
var x = C();
// Argument evaluted before `x.a`
x.a((() {
print('Argument evaluated');
return 1;
})());
print('---');
// Argument evaluted after `x.a`
(x.a)((() {
print('Argument evaluated');
return 1;
})());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment