getRealtimeWeatherByCityName method

Future<RealtimeWeather> getRealtimeWeatherByCityName(
  1. String cityName, {
  2. bool airQualityIndex = false,
})

Fetch Realtime API data by city name.

Implementation

Future<RealtimeWeather> getRealtimeWeatherByCityName(String cityName,
    {bool airQualityIndex = false}) async {
  Map<String, dynamic>? jsonResponse =
      await _sendRequest<Map<String, dynamic>>(APIType.realtime,
          cityName: cityName, airQualityIndex: airQualityIndex);

  return RealtimeWeather(jsonResponse!);
}