getMethod abstract method

Method? getMethod(
  1. String name
)

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:

Implementation

Method? getMethod(String name);