Skip to content

Instantly share code, notes, and snippets.

@osa1
Created November 11, 2022 19:57
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/fbb514011a2197bad0435d117a8cca8c to your computer and use it in GitHub Desktop.
Save osa1/fbb514011a2197bad0435d117a8cca8c to your computer and use it in GitHub Desktop.
Strange Dart 1
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