getMethod abstract method
Returns a method by its methodName, or null if no method with that name exists.
Useful for dynamic invocation or analyzing a specific method’s parameters, return type, and metadata.
Example
final addMethod = clazz.getMethod('add');
if (addMethod != null) {
print(addMethod.getReturnType().getName()); // int
}
Implementation
MethodDeclaration? getMethod(String methodName);