toJson method

Map<String, dynamic> toJson()

Convert this object to a JSON object.

Implementation

Map<String, dynamic> toJson() {
  final Coordinates? latLng = coordinates;

  return <String, dynamic>{
    'city': city,
    if (latLng != null) 'coordinates': latLng.toJson(),
    'country': country,
    'state': state,
  };
}