PossibleIntervention.fromJson constructor
Factory constructor to create an instance from JSON.
Implementation
factory PossibleIntervention.fromJson(Map<String, dynamic> json) {
return PossibleIntervention(
scoringType: json['scoringType'] as String?,
startTime: json['startTime'] as String?,
startLatitude: json['startLatitude']?.toDouble(),
startLongitude: json['startLongitude']?.toDouble(),
startAddress: json['startAddress'] != null
? PossibleInterventionAddress.fromJson(json['startAddress'])
: null,
endTime: json['endTime'] as String?,
endLatitude: json['endLatitude']?.toDouble(),
endLongitude: json['endLongitude']?.toDouble(),
endAddress: json['endAddress'] != null
? PossibleInterventionAddress.fromJson(json['endAddress'])
: null,
scoreStats: json['scoreStats'] != null
? (json['scoreStats'] as Map<String, dynamic>).map(
(key, value) => MapEntry(
key,
value != null
? PossibleInterventionScoreStats.fromJson(value)
: null,
),
)
: null,
);
}