Zone.fromJson constructor
Implementation
factory Zone.fromJson(Map<String, dynamic> json) {
List<LatLng> jsonCoordinates = [];
if (json[JsonKeys.coordinates] != null) {
List coordinatesJsonList = json[JsonKeys.coordinates] as List;
for (Map<String, double> coordinates in coordinatesJsonList) {
jsonCoordinates.add(LatLng.degree(
coordinates[JsonKeys.latitude]!,
coordinates[JsonKeys.longitude]!,
));
}
}
return Zone(
id: json[JsonKeys.id],
radius: json[JsonKeys.radius],
coordinates: jsonCoordinates,
notificationResponsivenessMs: json[JsonKeys.notificationResponsivenessMs],
);
}