Main.fromJson constructor Null safety

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

Implementation

factory Main.fromJson(Map<String, dynamic> json) => Main(
      temp: json["temp"]?.toDouble() ?? 0,
      feelsLike: json["feels_like"]?.toDouble() ?? 0,
      tempMin: json["temp_min"]?.toDouble() ?? 0,
      tempMax: json["temp_max"]?.toDouble() ?? 0,
      pressure: json["pressure"] ?? 0,
      humidity: json["humidity"] ?? 0,
      seaLevel: json["sea_level"] ?? 0,
      grndLevel: json["grnd_level"] ?? 0,
    );