Skip to content
pubscout

weather_kit

0.3.0, released 2 years ago by mafreud.dev

A Dart library for interfacing with the Apple WeatherKit API.

$ flutter pub add weather_kit
Source repository

What it does

Provides a client interface to communicate with the Apple WeatherKit API. Allows generating JWT tokens using Apple developer credentials and fetching weather data for specific coordinates.

AI-written summary of version 0.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to fetch weather forecasts or current weather from Apple's WeatherKit API.
  • You are a member of the Apple Developer Program and have configured a WeatherKit key.

Skip it when

  • You are not a member of the Apple Developer Program.
  • You need a weather API provider that does not require Apple credentials and JWT generation.

Strengths

  • Simplifies integration with Apple WeatherKit API in Dart and Flutter.
  • Includes helper methods for generating JWT tokens required by Apple.

Weaknesses

  • Requires an Apple Developer Program membership, Team ID, Key ID, and p8 certificate.
  • Limited documentation and examples beyond basic JWT generation and weather data fetching.

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
No
Direct dependencies
2

Requires registering an app Bundle ID, obtaining a Team ID, and downloading a p8 certificate from the Apple Developer portal.

final weatherKit = WeatherKit();
final token = weatherKit.generateJWT(
  bundleId: 'com.example',
  teamId: 'team id',
  keyId: 'key id',
  pem: 'example.p8',
  expiresIn: const Duration(hours: 1),
);

final result = await weatherKit.obtainWeatherData(
  jwt: token,
  language: 'ja',
  latitude: '35.71',
  longitude: '139.811',
  dataSets: 'currentWeather',
);

Alternatives

Packages that do the same job and could replace weather_kit.

  • dio

    If you need an advanced HTTP client with interceptors and global configurations for your API calls.

Works with

Packages commonly used together with weather_kit: ones it builds on, ones built on it, and its own family.