fromElement static method
ClientParam?
fromElement(
- FormalParameterElement element, {
- Map<String, DartType> typeSubstitutions = const {},
})
Implementation
static ClientParam? fromElement(
FormalParameterElement element, {
Map<String, DartType> typeSubstitutions = const {},
}) {
final (:acceptMultiple, :access, :position) = _getPosition(
element.name,
({required List<OnMatch> onMatch, NonMatch? onNonMatch}) =>
getAnnotations(
element: element,
onMatch: onMatch,
onNonMatch: onNonMatch,
),
);
if (position == null) {
return null;
}
final name = element.name;
if (name == null) {
return null;
}
final paramType = typeSubstitutions.isEmpty
? element.type
: substituteType(element.type, typeSubstitutions);
return ClientParam(
name: name,
type: ClientType.fromType(paramType),
position: position,
access: access,
acceptMultiple: acceptMultiple,
hasDefaultValue: element.defaultValueCode != null,
);
}