Created
November 11, 2022 19:57
-
-
Save osa1/fbb514011a2197bad0435d117a8cca8c to your computer and use it in GitHub Desktop.
Strange Dart 1
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
void voidFun() => 123; | |
class A<T> { | |
T x; | |
A (this.x); | |
Object? getX() => x; | |
} | |
void main() { | |
A<void> a = A<void>(null); | |
a.x = voidFun(); // return value of void function assigned to field | |
print(a.getX()); // prints '123' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment