findFunctionByNameAndNbOfParameters method

ContractFunction findFunctionByNameAndNbOfParameters(
  1. String name,
  2. int nbParameters
)

Finds the external or public function defined by the contract that has the provided name and the number of params nbParameters

Implementation

ContractFunction findFunctionByNameAndNbOfParameters(
    String name, int nbParameters) {
  final functionsSelected = functions.where((f) => f.name == name);
  for (final functionSelected in functionsSelected) {
    if (functionSelected.parameters.length == nbParameters) {
      return functionSelected;
    }
  }
  throw Error();
}