Created
August 16, 2019 07:26
-
-
Save pinyin/8494d39be3c472351640c1fbb2fa618b to your computer and use it in GitHub Desktop.
Dart call & noSuchMethod
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
void main() { | |
final func = Callable((a)=> print(a)); | |
func('a'); | |
} | |
class Callable { | |
Function func; | |
@override | |
noSuchMethod(invocation) { | |
Function.apply(func, invocation.positionalArguments, invocation.namedArguments); | |
} | |
Callable(this.func); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment