Skip to content

Instantly share code, notes, and snippets.

@lrhn
Created February 17, 2021 10:11
Show Gist options
  • Save lrhn/07661e077b18aef61976d98e8dceb0b0 to your computer and use it in GitHub Desktop.
Save lrhn/07661e077b18aef61976d98e8dceb0b0 to your computer and use it in GitHub Desktop.
Example of assigning callable object to nullable function type.
class C {
void call([int? x]) {
print("works!");
}
}
typedef VoidCallback = void Function();
void main() {
VoidCallback? f = C();
f!();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment