area_polygon 1.0.2 copy "area_polygon: ^1.0.2" to clipboard
area_polygon: ^1.0.2 copied to clipboard

Calculate the area of a simple 2D polygon given its vertices. A Dart port of the area-polygon npm package.

example/main.dart

import 'dart:ui' show Offset;

import 'package:area_polygon/area_polygon.dart';

void main() {
  const List<Offset> points = [
    // your points here, e.g. a 4x4 square:
    Offset(0, 0),
    Offset(0, 4),
    Offset(4, 4),
    Offset(4, 0),
  ];
  final double area = calculateArea(points); // 16
  print('Area: $area');
}
0
likes
140
pub points
40%
popularity

Publisher

verified publisheradil.hanney.org

Calculate the area of a simple 2D polygon given its vertices. A Dart port of the area-polygon npm package.

Repository (GitHub)
View/report issues

Topics

#math #polygons #js-port

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on area_polygon