findBeginToken function

Token findBeginToken(
  1. ParameterElement element
)

Implementation

Token findBeginToken(ParameterElement element) {
  final parsedLibrary =
      element.session.getParsedLibraryByElement(element.library);
  final declaration = parsedLibrary.getElementDeclaration(element);
  final parameter = declaration.node as FormalParameter;
  if (parameter is DefaultFormalParameter &&
      parameter.parameter is SimpleFormalParameter) {
    return (parameter.parameter as SimpleFormalParameter).type.beginToken;
  } else {
    return parameter.beginToken;
  }
}