fromJson static method
Implementation
static CallReference fromJson(
Map<String, Object?> json,
List<Constant> constants,
List<Location> locations,
) {
final loadingUnit = json[_loadingUnitKey] as String?;
final location = locations[json[_locationKey] as int];
return json[_typeKey] == 'tearoff'
? CallTearOff(loadingUnit: loadingUnit, location: location)
: CallWithArguments(
positionalArguments:
(json[_positionalKey] as List<dynamic>? ?? [])
.whereType<int?>()
.map(
(constantsIndex) =>
constantsIndex != null
? constants[constantsIndex]
: null,
)
.toList(),
namedArguments: (json[_namedKey] as Map<String, Object?>? ?? {})
.map((key, value) => MapEntry(key, value as int?))
.map(
(name, constantsIndex) => MapEntry(
name,
constantsIndex != null ? constants[constantsIndex] : null,
),
),
loadingUnit: loadingUnit,
location: location,
);
}