getMethod abstract method
Gets a method by its name.
Parameters:
name
: The method name to look up
Returns:
- The first matching method found
null
if no method with this name exists
Example:
class Calculator {
int add(int a, int b) => a + b;
}
final method = Class.forType<Calculator>().getMethod('add');
print(method?.returnType.getName()); // 'int'
Note:
- Does not consider inheritance hierarchy
- For overloaded methods, use getMethodBySignature
Implementation
Method? getMethod(String name);