BMFWeatherSearchResult.fromMap constructor

BMFWeatherSearchResult.fromMap(
  1. Map map
)

map => BMFWeatherSearchResult

Implementation

BMFWeatherSearchResult.fromMap(Map map)
    : assert(map != null,
          'Construct a BMFWeatherSearchResult,The parameter map cannot be null !') {
  realTimeWeather = map['realTimeWeather'] == null
      ? null
      : BMFWeatherSearchNow.fromMap(map['realTimeWeather']);
  location = map['location'] == null
      ? null
      : BMFWeatherSearchLocation.fromMap(map['location']);
  if (map['forecasts'] != null) {
    forecasts = new List<BMFWeatherSearchForecasts>();
    map['forecasts'].forEach((v) {
      forecasts.add(BMFWeatherSearchForecasts.fromMap(v as Map));
    });
  }
  if (map['forecastHours'] != null) {
    forecastHours = new List<BMFWeatherSearchForecastForHours>();
    map['forecastHours'].forEach((v) {
      forecastHours.add(BMFWeatherSearchForecastForHours.fromMap(v as Map));
    });
  }
  if (map['lifeIndexes'] != null) {
    lifeIndexes = new List<BMFWeatherSearchIndexes>();
    map['lifeIndexes'].forEach((v) {
      lifeIndexes.add(BMFWeatherSearchIndexes.fromMap(v as Map));
    });
  }
  if (map['weatherAlerts'] != null) {
    weatherAlerts = new List<BMFWeatherSearchAlerts>();
    map['weatherAlerts'].forEach((v) {
      weatherAlerts.add(BMFWeatherSearchAlerts.fromMap(v as Map));
    });
  }
}