Created
December 20, 2022 19:05
-
-
Save osa1/a23ae7b3ed9800240644bb2392370ce7 to your computer and use it in GitHub Desktop.
Strange Dart 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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