Skip to content

Instantly share code, notes, and snippets.

@pinyin
Created August 16, 2019 07:26
Show Gist options
  • Save pinyin/8494d39be3c472351640c1fbb2fa618b to your computer and use it in GitHub Desktop.
Save pinyin/8494d39be3c472351640c1fbb2fa618b to your computer and use it in GitHub Desktop.
Dart call & noSuchMethod
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