# getMethod abstract method

Method getMethod([

1. String? methodName

])

Retrieves a top-level method by its name.

- If `methodName` is provided, it returns the matching method.
- If omitted or `null`, it may return a default method depending on the implementation.

### Example

    final mainMethod = resource.getMethod('main');
    print('Method: ${mainMethod.name}');

## Implementation

    Method getMethod([String? methodName]);