dart_earcut
1.2.0, released 2 years ago by jaffaketchup.dev
Performant ear-clipping polygon triangulation algorithm
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.
87Compare - exif_reader
Decode EXIF metadata from various image formats in Dart, Web, and Flutter.
73Compare - eval_ex
Mathematical and boolean expression evaluator supporting arbitrary precision.
44Compare - bezier
A 2D Bézier curve math library supporting quadratic and cubic curves.
50Compare
Works with
Packages commonly used together with dart_earcut: ones it builds on, ones built on it, and its own family.
- dart_polylabel2Same familyCalculates the pole of inaccessibility for polygons to place labels optimally.
- flutter_mapBuilt on dart_earcutPure‑Flutter map client with tile loading, markers, and gestures
- flutter_map_tile_cachingBuilt on dart_earcutAdvanced caching and offline map region downloading for flutter_map.