Geolocation.fromJson constructor
Geolocation.fromJson(
- dynamic json
Creates a new Geolocation from a json
respones
Implementation
factory Geolocation.fromJson(dynamic json) {
if (json
case {
'lat': num lat,
'lon': num lon,
}) {
return Geolocation(
latitude: lat.toDouble(),
longitude: lon.toDouble(),
);
} else {
throw ArgumentError.value(
json,
'Invalid json format for parsing Geolocation',
);
}
}