smhi 0.0.1-dev.3 copy "smhi: ^0.0.1-dev.3" to clipboard
smhi: ^0.0.1-dev.3 copied to clipboard

discontinuedreplaced by: weather
outdated

A Dart package for usage of the Swedish Meteorological and Hydrological Institute's Open Data API

example/smhi_example.dart

import 'package:smhi/smhi.dart';

void main() => getTemperatureTomorrow();

///Gets the air temperature at this time tomorrow in Stockholm.
Future<void> getTemperatureTomorrow() async {
  final MeteorologicalForecasts meteorologicalForecasts =
      MeteorologicalForecasts();
  final Forecast? forecast = await meteorologicalForecasts
      .forecast(const GeoPoint(59.334591, 18.063240));
  if (forecast != null) {
    //Forecasts are divided into moments where each moment represents a date & time.
    //Read more at SMHI's documentation: https://opendata.smhi.se/apidocs/metfcst/get-forecast.html
    final ForecastMoment moment =
        forecast.momentWhen(DateTime.now().add(const Duration(days: 1)));
    print(moment.valueOf(MetFcstParameter.airTemperature));
  }
}
3
likes
0
points
21
downloads

Publisher

verified publisherpallhed.se

Weekly Downloads

A Dart package for usage of the Swedish Meteorological and Hydrological Institute's Open Data API

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http, intl

More

Packages that depend on smhi