smhi 0.0.2-dev.1 copy "smhi: ^0.0.2-dev.1" to clipboard
smhi: ^0.0.2-dev.1 copied to clipboard

discontinuedreplaced by: weather

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
110
pub points
0%
popularity

Publisher

verified publisherpallhed.se

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (LICENSE)

Dependencies

http, intl

More

Packages that depend on smhi