OpenWeather.fromJson constructor Null safety

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

Implementation

factory OpenWeather.fromJson(Map<String, dynamic> json) => OpenWeather(
      coord: Coord.fromJson(json["coord"]),
      weather: json["weather"] != null ? List<Weather>.from(json["weather"].map((x) => Weather.fromJson(x))) : [],
      base: json["base"],
      main: Main.fromJson(json["main"]),
      visibility: json["visibility"],
      wind: Wind.fromJson(json["wind"]),
      snow: json.containsKey("snow") ? Snow.fromJson(json["snow"]) : null,
      rain: json.containsKey("rain") ? Snow.fromJson(json["rain"]) : null,
      clouds: Clouds.fromJson(json["clouds"]),
      dt: json["dt"],
      sys: Sys.fromJson(json["sys"]),
      timezone: json["timezone"],
      id: json["id"],
      name: json["name"],
      cod: json["cod"],
    );