Reputation: 2149
Is there something similar to anonymous closures in Dart? Or is this feature unnecessary with OOP? Is there a workaround?
Thanks.
Upvotes: 1
Views: 1800
Reputation: 76283
You can do the same thing in Dart.
For instance :
main() {
(() => print('hello'))();
}
That said those kind of anonymous closures are almost useless because Dart has lexical scope and you have to run Dart code inside a main
function.
Upvotes: 8