checkValidity method

String? checkValidity(
  1. MethodInvocation node
)

Returns a String describing why the node is invalid, or null if no reason is found, so it's presumed valid.

Implementation

String? checkValidity(MethodInvocation node) {
  if (parameters == null) {
    return "Calls to Intl must be inside a method, field declaration or "
        "top level declaration.";
  }
  // The containing function cannot have named parameters.
  if (parameters!.parameters.any((each) => each.isNamed)) {
    return "Named parameters on message functions are not supported.";
  }
  var arguments = node.argumentList.arguments;
  var instance = _expectedInstance(node.methodName.name);
  return instance?.checkValidity(node, arguments, name, parameters!,
      nameAndArgsGenerated: generateNameAndArgs,
      examplesRequired: extraction.examplesRequired);
}