LocationInfo.fromJson constructor

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

Creates a LocationInfo from a JSON object.

Implementation

factory LocationInfo.fromJson(Map<String, dynamic> json) => LocationInfo(
      country: json['country'] ?? '',
      countryCode: json['country_code'] ?? '',
      city: json['city'] ?? '',
      state: json['state'] ?? '',
      zipcode: json['zipcode'] ?? '',
      latitude: (json['latitude'] ?? 0).toDouble(),
      longitude: (json['longitude'] ?? 0).toDouble(),
      timezone: json['timezone'] ?? '',
      localtime: json['localtime'] ?? '',
    );