toMap method Null safety

  1. @override
Map<String, Object?> toMap()

Implementation

@override
Map<String, Object?> toMap() {
  return {
    'realTimeWeather': this.realTimeWeather?.toMap(),
    'location': this.location?.toMap(),
    'forecasts': this.forecasts?.map((e) => e.toMap()).toList(),
    'forecastHours': this.forecastHours?.map((e) => e.toMap()).toList(),
    'lifeIndexes': this.lifeIndexes?.map((e) => e.toMap()).toList(),
    'weatherAlerts': this.weatherAlerts?.map((e) => e.toMap()).toList()
  };
}