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

Pub style: lint

SMHI Open Data for Dart #

A Dart package for usage of the SMHI Open Data API. The API allows you to get the weather and other meterological data like air temperature & pressure. At the time of writing this, the Meteorological Forecasts API is available in the following countries:

  • Sweden
  • Norway
  • Finland
  • Denmark
  • Estonia

And partly:

  • Latvia
  • Lithuania

Usage #

This example shows how to get the air temperature at this time tomorrow in Stockholm:

import 'package:smhi/smhi.dart';

final MeteorologicalForecasts meteorologicalForecasts = MeteorologicalForecasts();
// Your request will automatically be cached. So if you make the same one again, it will return the cached version.
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));
}

Supported SMHI Open Data APIs #

API Supported
Meteorological Forecasts ✅ (Only pmp3gv2)

Terms of use #

You can find SMHI's terms of use and their documentation on their website, written in Swedish and English respectively. Their open data follows the Creative Commons Attribution 4.0 International (CC BY 4.0) license.

To prevent high unnecessary usage of SMHI's API, requests will automatically be cached. You can clear the cache manually:

SMHICache().clear();

Features and bugs #

Please file feature requests and bugs at the issue tracker.

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