JavaMethod.parse constructor
JavaMethod.parse(
- String declaration
Parses a Java method declaration.
Accepts what you would read in Java source or javap output:
JavaMethod.parse('String greet()');
JavaMethod.parse('public static int add(int a, int b)');
JavaMethod.parse('java.util.List<String> subList(int, int)');
JavaMethod.parse('void write(byte[]) throws java.io.IOException');
JavaMethod.parse('(String, int)'); // a constructor
Modifiers, annotations, parameter names, generic arguments and a throws
clause are all ignored, so a declaration can be pasted in unedited. The
return type may be omitted only when there is nothing before the (, in
which case this is a constructor and returns void.
Implementation
factory JavaMethod.parse(String declaration) =>
_methodCache[declaration] ??= _parseMethod(declaration);