Skip to content

Instantly share code, notes, and snippets.

@unixpickle
Created July 18, 2014 22:19
Show Gist options
  • Save unixpickle/f5b00f4abffb5fe82abe to your computer and use it in GitHub Desktop.
Save unixpickle/f5b00f4abffb5fe82abe to your computer and use it in GitHub Desktop.
Get function signature for main()
import 'dart:io';
typedef void EmptyFunc();
typedef void OneFunc(List<String> _);
myMain1(List<String> _) {
}
myMain2() {
}
int getType(fn) {
if (fn is EmptyFunc) {
return 1;
} else {
return 2;
}
}
main() {
print(getType(myMain1));
print(getType(myMain2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment