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((index) {
return index != null ? constants[index] : null;
})
.toList(),
namedArguments: (json[_namedKey] as Map<String, Object?>? ?? {}).map(
(key, value) =>
MapEntry(key, value != null ? constants[value as int] : null),
),
loadingUnit: loadingUnit,
location: location,
);
}