Element.fromJson constructor
Element.fromJson(})
Implementation
factory Element.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'Element'", json);
}
ElementKind kind;
if (json case {'kind': var encodedKind}) {
kind = ElementKind.fromJson(
jsonDecoder,
'$jsonPath.kind',
encodedKind,
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'kind'", json);
}
String name;
if (json case {'name': var encodedName}) {
name = jsonDecoder.decodeString('$jsonPath.name', encodedName);
} else {
throw jsonDecoder.mismatch(jsonPath, "'name'", json);
}
Location? location;
if (json case {'location': var encodedLocation}) {
location = Location.fromJson(
jsonDecoder,
'$jsonPath.location',
encodedLocation,
clientUriConverter: clientUriConverter,
);
}
int flags;
if (json case {'flags': var encodedFlags}) {
flags = jsonDecoder.decodeInt('$jsonPath.flags', encodedFlags);
} else {
throw jsonDecoder.mismatch(jsonPath, "'flags'", json);
}
String? parameters;
if (json case {'parameters': var encodedParameters}) {
parameters = jsonDecoder.decodeString(
'$jsonPath.parameters',
encodedParameters,
);
}
String? returnType;
if (json case {'returnType': var encodedReturnType}) {
returnType = jsonDecoder.decodeString(
'$jsonPath.returnType',
encodedReturnType,
);
}
String? typeParameters;
if (json case {'typeParameters': var encodedTypeParameters}) {
typeParameters = jsonDecoder.decodeString(
'$jsonPath.typeParameters',
encodedTypeParameters,
);
}
String? aliasedType;
if (json case {'aliasedType': var encodedAliasedType}) {
aliasedType = jsonDecoder.decodeString(
'$jsonPath.aliasedType',
encodedAliasedType,
);
}
String? extendedType;
if (json case {'extendedType': var encodedExtendedType}) {
extendedType = jsonDecoder.decodeString(
'$jsonPath.extendedType',
encodedExtendedType,
);
}
return Element(
kind,
name,
flags,
location: location,
parameters: parameters,
returnType: returnType,
typeParameters: typeParameters,
aliasedType: aliasedType,
extendedType: extendedType,
);
}