getMethod method

MethodDeclaration? getMethod(
  1. String name
)

Returns a class method by its name.

If a method with the specified name is not found, returns null.

name - The name of the method to find.

Return value:

  • MethodDeclaration?: The method with the given name, or null if not found.

Implementation

MethodDeclaration? getMethod(String name) =>
    classMembers.firstWhereOrNull(
          (ClassMember node) =>
              node is MethodDeclaration && node.name.lexeme == name,
        )
        as MethodDeclaration?;