Skip to content
pubscout

google_maps_utils

5.0.0, released 4 months ago by adriankohls.app

Port of Google's android-maps-utils for spherical geometry, polylines, and math in Dart.

WASM-ready
$ flutter pub add google_maps_utils
Source repository

What it does

Provides core geometry, geodesy, and math utilities ported from Google's android-maps-utils library. Includes calculations for distances, headings, bounding boxes, polyline encoding/decoding, and Douglas-Peucker simplification.

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

Use it when

  • You need to calculate distances, headings, or areas between geographical coordinates.
  • You need to encode or decode Google polyline strings in a Dart or Flutter application.
  • You need spatial calculations like point-in-polygon or path simplification without heavy map rendering dependencies.

Skip it when

  • You need a full interactive map widget (use a mapping package instead).
  • You only need basic non-geographical math operations.

Strengths

  • Exact algorithmic parity with Google's android-maps-utils library.
  • Cross-platform support including mobile, web, and desktop.
  • Zero external dependencies.

Weaknesses

  • Only a small subset (3 out of 78) of the full android-maps-utils classes have been ported so far.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:google_maps_utils/google_maps_utils.dart';

final distance = GoogleMapsUtils.spherical.computeDistanceBetween(from, to);
final path = GoogleMapsUtils.poly.decode(encodedString);

Alternatives

Packages that do the same job and could replace google_maps_utils.

  • latlong2

    A pure Dart library for distance and geometry calculations often used alongside flutter_map.