hasMatchingMethod abstract method

bool hasMatchingMethod(
  1. Method method
)

Evaluates whether this context contains a method with a signature that matches the provided method definition.

A match requires an exact correspondence in both the method name and the precise order and types of its parameters, as resolved by getMethodBySignature.

Example

final standardSave = Class.forType<CrudRepository>().getMethodBySignature('save', [Class.forType<User>()]);

if (repositoryFragment.hasMatchingMethod(standardSave!)) {
  print('Target fragment can safely intercept this method execution.');
}

Implementation

bool hasMatchingMethod(Method method);