weather 0.1.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 87

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`:
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app uses location to forecast the weather.</string>
<key>NSLocationAlwaysUsageDescription</key>
<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: https://stackoverflow.com/questions/44379348/the-use-of-swift-3-objc-inference-in-swift-4-mode-is-deprecated

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.

example/README.md

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:


dependencies:
  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...

Popularity:
Describes how popular the package is relative to other packages. [more]
79
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/weather.dart.

Run flutter format to format lib/weather.dart.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Running dartdoc failed with the following output: DetailedApiRequestError(status: 500, message: Backend Error)

#0      _validateResponse (package:_discoveryapis_commons/src/clients.dart:875:9)
<asynchronous suspension>
#1      ApiRequester.request (package:_discoveryapis_commons/src/clients.dart:69:22)
<asynchronous suspension>
#2      ObjectsResourceApi.insert (package:googleapis/storage/v1.dart:3068:32)
#3      _MediaUploadStreamSink._startNormalUpload (file:///root/.pub-cache/hosted/pub.dartlang.org/gcloud-0.6.0+4/lib/src/storage_impl.dart:599:10)
#4      new _MediaUploadStreamSink (file:///root/.pub-cache/hosted/pub.dartlang.org/gcloud-0.6.0+4/lib/src/storage_impl.dart:514:9)
#5      _BucketImpl.write (file:///root/.pub-cache/hosted/pub.dartlang.org/gcloud-0.6.0+4/lib/src/storage_impl.dart:179:16)
#6      uploadWithRetry.<anonymous closure> (package:pub_dartlang_org/shared/storage.dart:49:27)
<asynchronous suspension>
#7      retryAsync (package:pub_dartlang_org/shared/utils.dart:431:24)
<asynchronous suspension>
#8      uploadWithRetry (package:pub_dartlang_org/shared/storage.dart:47:9)
<asynchronous suspension>
#9      DartdocBackend.uploadDir.upload (package:pub_dartlang_org/dartdoc/backend.dart:130:13)
<asynchronous suspension>
#10     DartdocBackend.uploadDir.<anonymous closure> (package:pub_dartlang_org/dartdoc/backend.dart:142:64)
#11     Pool.withResource (package:pool/pool.dart:127:28)
<asynchronous suspension>
#12     DartdocBackend.uploadDir (package:pub_dartlang_org/dartdoc/backend.dart:142:39)
<asynchronous suspension>
#13     DartdocJobProcessor.process (package:pub_dartlang_org/dartdoc/dartdoc_runner.dart:226:30)
<asynchronous suspension>
#14     JobProcessor.run (package:pub_dartlang_org/job/job.dart:55:28)
<asynchronous suspension>
#15     JobMaintenance.run (package:pub_dartlang_org/job/job.dart:95:18)
#16     _workerMain.<anonymous closure> (file:///project/app/bin/service/dartdoc.dart:81:26)
#17     _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#18     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#19     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#20     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#21     _rootRunUnary (dart:async/zone.dart:1132:38)
#22     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#23     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#24     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#25     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#26     Future._complete (dart:async/future_impl.dart:473:7)
#27     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#28     _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
#29     _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:294:13)
#30     DartdocJobProcessor.generateDocsForSdk (package:pub_dartlang_org/dartdoc/dartdoc_runner.dart)
#31     _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#32     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#33     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#34     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#35     _rootRunUnary (dart:async/zone.dart:1132:38)
#36     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#37     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#38     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#39     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#40     Future._complete (dart:async/future_impl.dart:473:7)
#41     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#42     _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
#43     _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:294:13)
#44     VersionedJsonStorage.hasCurrentData (package:pub_dartlang_org/shared/storage.dart)
#45     _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#46     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#47     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#48     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#49     _rootRunUnary (dart:async/zone.dart:1132:38)
#50     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#51     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#52     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#53     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#54     Future._complete (dart:async/future_impl.dart:473:7)
#55     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#56     _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
#57     _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:294:13)
#58     ApiRequester.request (package:_discoveryapis_commons/src/clients.dart)
#59     _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#60     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#61     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#62     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#63     _rootRunUnary (dart:async/zone.dart:1132:38)
#64     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#65     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#66     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#67     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#68     Future._complete (dart:async/future_impl.dart:473:7)
#69     Stream.join.<anonymous closure> (dart:async/stream.dart:762:14)
#70     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#71     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#72     _rootRun (dart:async/zone.dart:1120:38)
#73     _CustomZone.run (dart:async/zone.dart:1021:19)
#74     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#75     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#76     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#77     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#78     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#79     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#80     _StringAdapterSink.close (dart:convert/string_conversion.dart:251:11)
#81     _Utf8ConversionSink.close (dart:convert/string_conversion.dart:302:20)
#82     _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:82:18)
#83     _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#84     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#85     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#86     _rootRun (dart:async/zone.dart:1120:38)
#87     _CustomZone.run (dart:async/zone.dart:1021:19)
#88     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#89     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#90     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#91     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#92     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#93     _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#94     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#95     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#96     _rootRun (dart:async/zone.dart:1120:38)
#97     _CustomZone.run (dart:async/zone.dart:1021:19)
#98     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#99     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#100    _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#101    _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#102    _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#103    _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#104    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#105    StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#106    _rootRun (dart:async/zone.dart:1120:38)
#107    _CustomZone.run (dart:async/zone.dart:1021:19)
#108    _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#109    _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#110    _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#111    _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#112    _SyncStreamController._sendDone (dart:async/stream_controller.dart:772:19)
#113    _StreamController._closeUnchecked (dart:async/stream_controller.dart:629:7)
#114    _StreamController.close (dart:async/stream_controller.dart:622:5)
#115    _HttpParser._closeIncoming (dart:_http/http_parser.dart:1037:23)
#116    _HttpParser._doParse (dart:_http/http_parser.dart:775:15)
#117    _HttpParser._parse (dart:_http/http_parser.dart:318:7)
#118    _HttpParser._onData (dart:_http/http_parser.dart:810:5)
#119    StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#120    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#121    StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#122    _rootRunUnary (dart:async/zone.dart:1132:38)
#123    _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#124    _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#125    _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#126    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#127    _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#128    _StreamController._add (dart:async/stream_controller.dart:640:7)
#129    _StreamController.add (dart:async/stream_controller.dart:586:5)
#130    _Socket._onData (dart:io/runtime/binsocket_patch.dart:1774:41)
#131    StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#132    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#133    StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#134    _rootRunUnary (dart:async/zone.dart:1132:38)
#135    _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#136    _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#137    _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#138    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#139    _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#140    _StreamController._add (dart:async/stream_controller.dart:640:7)
#141    _StreamController.add (dart:async/stream_controller.dart:586:5)
#142    _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1004:19)
#143    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#144    StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#145    _rootRun (dart:async/zone.dart:1120:38)
#146    _CustomZone.run (dart:async/zone.dart:1021:19)
#147    _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#148    _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#149    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#150    StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#151    _rootRun (dart:async/zone.dart:1124:13)
#152    _CustomZone.run (dart:async/zone.dart:1021:19)
#153    _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#154    Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#155    _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#156    _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#157    _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

Dependencies

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+2
location ^1.4.1 1.4.1 2.3.5
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6 1.1.7
path 1.6.2
pedantic 1.5.0
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8