parameters property

List<Parameter> parameters

Implementation

List<Parameter> get parameters {
  if (!canHaveParameters) {
    throw StateError('$element cannot have parameters');
  }

  if (_parameters == null) {
    List<ParameterElement> params;

    if (element is ExecutableElement) {
      if (_originalMember != null) {
        assert(_originalMember is ExecutableMember);
        params = (_originalMember as ExecutableMember).parameters;
      } else {
        params = (element as ExecutableElement).parameters;
      }
    }
    if (params == null && element is FunctionTypedElement) {
      if (_originalMember != null) {
        params = (_originalMember as dynamic).parameters;
      } else {
        params = (element as FunctionTypedElement).parameters;
      }
    }
    if (params == null && element is FunctionTypeAliasElement) {
      params = (element as FunctionTypeAliasElement).function.parameters;
    }

    _parameters = UnmodifiableListView<Parameter>(params
        .map((p) => ModelElement.from(p, library, packageGraph) as Parameter)
        .toList());
  }
  return _parameters;
}