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

discontinuedreplaced by: weather
outdated

A Dart wrapper of the SMHI 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(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
pub points
0%
popularity

Publisher

verified publisherpallhed.se

A Dart wrapper of the SMHI Open Data API

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, intl

More

Packages that depend on smhi