/weather_sdk

Primary LanguageDartOtherNOASSERTION

Installation

  weather_sdk:
    git:
      url: https://github.com/ponnamkarthik/weather_sdk

Usage

final WeatherSDK _weatherSDK = WeatherSDK();

// Update Units
_weatherSDK.updateUnits(TemperatureUnit.metric);

// Search for location
_weatherSDK.searchLocation(query)

// Fetch Weather Data
_weatherSDK.fetchWeather(latitude, longitude, dateTime)

Initializing Weather

final sdkInitializer = WeatherSDKInitializer();
sdkInitializer.initialize(apiKey: "bd5e378503939ddaee76f12ad7a97608");

Listen for unit changes

WeatherSDKInitializer().unitsStream.listen((units) {
// Units have changed, refresh weather data
setState(() {});
});

Weather Widget

WeatherWidget(
    dateTime: selectedWeatherDate,
    latitude: _locationData!.lat,
    longitude: _locationData!.lon,
)