Created
February 17, 2021 10:11
-
-
Save lrhn/07661e077b18aef61976d98e8dceb0b0 to your computer and use it in GitHub Desktop.
Example of assigning callable object to nullable function type.
This file contains hidden or 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 { | |
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