Location.fromJson constructor

Location.fromJson(
  1. Map<String, dynamic> json
)

Creates a Location from a JSON map.

Expects a map with 'lat' and 'lng' keys containing numeric values.

Example:

final json = {'lat': 40.7128, 'lng': -74.0060};
final location = Location.fromJson(json);

Implementation

factory Location.fromJson(Map<String, dynamic> json) {
  return Location(
    lat: (json['lat'] as num).toDouble(),
    lng: (json['lng'] as num).toDouble(),
  );
}