parameters property

List<Parameter> parameters

Implementation

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

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

    if (element is TypeAliasElement) {
      _parameters = ModelElement.fromElement(
              (element as TypeAliasElement).aliasedElement, packageGraph)
          .parameters;
    } else {
      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 FunctionTypedElement).parameters;
        } else {
          params = (element as FunctionTypedElement).parameters;
        }
      }
      _parameters = UnmodifiableListView(params
          .map(
              (p) => ModelElement.from(p, library, packageGraph) as Parameter)
          .toList(growable: false));
    }
  }
  return _parameters;
}