air_quality 1.1.0

  • Readme
  • Changelog
  • Installing
  • 74

Air Quality Index #

Collects air quality index from the World's Air Quality Index service.

Permissions #

No permissions needed.

Usage #

Imports #

The location package is also needed for the AirQuality package.

import 'package:air_quality/air_quality.dart';

Initialization #

An API key is needed in order to perform queries. An API key is obtained here: https://aqicn.org/api/

Example:

String key = 'XXX38456b2b85c92647d8b65090e29f957638c77';
AirQuality airQuality = new AirQuality(key);

Air Quality Feed Examples #

/// Via city name (Munich)
AirQualityData feedFromCity = 
    await airQuality.feedFromCity('munich');

/// Via station ID (Gothenburg weather station)
AirQualityData feedFromStationId = 
    await airQuality.feedFromStationId('7867');

/// Via Geo Location (Berlin)
AirQualityData feedFromGeoLocation = 
    await airQuality.feedFromGeoLocation('52.6794', '12.5346');

/// Via IP (depends on service provider)
AirQualityData fromIP = 
    await airQuality.feedFromIP();

1.1.0 #

  • Released as a Flutter package (rather than a plugin).

1.0.3 #

  • No longer depends on an external location package.

1.0.0 #

  • Now supports both city name queries as well as Location queries.

Use this package as a library

1. Depend on it

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


dependencies:
  air_quality: ^1.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:air_quality/air_quality.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
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]
74
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/air_quality.dart.

Run flutter format to format lib/air_quality.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and air_quality.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0 0.12.0+4
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.6.4
pedantic 1.9.0
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test