area 1.0.0

Area #

Calculate the area (in square meters) of a GeoJSON polygon or multipolygon.

Usage #

import 'package:area/area.dart';

const world = {
  'type': 'Polygon',
  'coordinates': [
    [
      [-180, -90],
      [-180, 90],
      [180, 90],
      [180, -90],
      [-180, -90]
    ]
  ]
};

print(area(world));

Tests #

Just run:

$ pub run test/area_test.dart

Credit #

[1.0.0] - 2019-07-09

  • Version 1.0.0 released.

[0.0.5] - 2019-07-08

  • Make package description longer

[0.0.4] - 2019-07-08

  • Add example/area.dart

[0.0.3] - 2019-07-08

  • Run dartfmt to format lib/area.dart

[0.0.2] - 2019-07-08

  • Minor fix

[0.0.1] - 2019-07-08

  • Initial release

example/area.dart

import 'package:area/area.dart';

main() {
  const world = {
    'type': 'Polygon',
    'coordinates': [
      [
        [-180, -90],
        [-180, 90],
        [180, 90],
        [180, -90],
        [-180, -90]
      ]
    ]
  };

  print("The world area is: ${area(world)} m²");
}

Use this package as a library

1. Depend on it

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


dependencies:
  area: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:area/area.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:area/area.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test any