Skip to content
pubscout

dart_earcut

1.2.0, released 2 years ago by jaffaketchup.dev

Performant ear-clipping polygon triangulation algorithm

WASM-readySingle maintainer
$ flutter pub add dart_earcut
Source repository

What it does

Triangulates 2D and multi-dimensional polygons with support for holes and Steiner points. It ports the Mapbox earcut algorithm to Dart for high-performance geometric computations.

AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to render complex polygons in 2D graphics or games
  • You are working with geographic data or custom map polygons

Skip it when

  • You are building a standard mobile UI with basic layout needs

Strengths

  • Handles holes and twisted polygons efficiently
  • Supports raw coordinate arrays and Point objects
  • No external dependencies

Weaknesses

  • Triangulation correctness is not strictly mathematically guaranteed for all degenerate inputs, though it attempts practical results

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
final triangles = Earcut.triangulateRaw([10,0, 0,50, 60,60, 70,10]);

Alternatives

Packages that do the same job and could replace dart_earcut.

  • unorm_dart

    Unicode normalization for Dart supporting NFC, NFD, NFKC, and NFKD forms.

  • exif_reader

    Decode EXIF metadata from various image formats in Dart, Web, and Flutter.

  • eval_ex

    Mathematical and boolean expression evaluator supporting arbitrary precision.

  • bezier

    A 2D Bézier curve math library supporting quadratic and cubic curves.

Works with

Packages commonly used together with dart_earcut: ones it builds on, ones built on it, and its own family.