weather 0.1.3

  • Example
  • Installing
  • Versions
  • 86

weather #

This package uses the OpenWeatherMAP API to get the current weather status as well as weather forecasts.

pub package

Install (Flutter) #

Add weather as a dependency in pubspec.yaml. For help on adding as a dependency, view the pubspec documenation.

Permissions #

The package uses your location to fetch weather data, therefore location tracking must be enabled.

Android #

Add the following entry to your manifest.xml file, in the Android project of your application:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

In addition, it is recommended to set your minimum SDK version to 21.

iOS #

  1. Open the XCode project of your app, named Runner.xcodeproj
  2. Locate the info.plist file in the Runner directory.
  3. Right click info.plist and choose Open as > Source Code.
  4. Add the following entries inside the <dict></dict> tags`:
<string>This app uses location to forecast the weather.</string>
<string>This app uses location to forecast the weather.</string>

Known issues #

There is an issue with the location plugin which this package depends on, where an error with the following message

The use of Swift 3 @objc inference in Swift 4 mode is deprecated

may be thrown. For a solution, check the following stack overflow question:

Usage #

First and foremost you need an API key from OpenWeatherMap, which can be acquired for free here.

WeatherStation weatherStation = new WeatherStation("YOUR_API_KEY");

Query current weather #

For api documentation on the current weather API, see the OpenWeatherMap weather API docs.

Weather weather = await weatherStation.getCurrentWeather();

For a complete list of all the properties of the Weather class, check the documentation

Get current temperature #

The Temperature class holds a temperature and can output the temperature in Celsius, Fahrenheit, and Kelvin:

double celsius = weather.temperature.celsius;
double fahrenheit = weather.temperature.celsius;
double kelvin = weather.temperature.kelvin;

Query 5 day forecast #

For API documentation on the forecast API, see the OpenWeatherMap forecast API docs.

List<Weather> forecasts = await weatherStation.getFiveDayForecast();

0.0.1 #

  • TODO: Describe initial release.


weather_example #

Demonstrates how to use the weather plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  weather: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:weather/weather.dart';
Version Uploaded Documentation Archive
0.1.3 Dec 10, 2018 Go to the documentation of weather 0.1.3 Download weather 0.1.3 archive
0.1.2 Dec 10, 2018 Go to the documentation of weather 0.1.2 Download weather 0.1.2 archive
0.1.1 Nov 30, 2018 Go to the documentation of weather 0.1.1 Download weather 0.1.1 archive
0.1.0 Nov 30, 2018 Go to the documentation of weather 0.1.0 Download weather 0.1.0 archive
0.0.9 Nov 30, 2018 Go to the documentation of weather 0.0.9 Download weather 0.0.9 archive
0.0.8 Nov 30, 2018 Go to the documentation of weather 0.0.8 Download weather 0.0.8 archive
0.0.7 Nov 29, 2018 Go to the documentation of weather 0.0.7 Download weather 0.0.7 archive
0.0.6 Nov 21, 2018 Go to the documentation of weather 0.0.6 Download weather 0.0.6 archive
0.0.5 Nov 21, 2018 Go to the documentation of weather 0.0.5 Download weather 0.0.5 archive
0.0.4 Nov 21, 2018 Go to the documentation of weather 0.0.4 Download weather 0.0.4 archive

All 14 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13
  • Flutter: 1.2.0


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/weather.dart.

Run flutter format to format lib/weather.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
http ^0.12.0 0.12.0+1
location ^1.4.1 1.4.1 2.0.0
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6 1.1.7
path 1.6.2
sky_engine 0.0.99
source_span 1.5.4
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8