Skip to content
pubscout

flutter_polyline_points

3.1.0, released a year ago by craftme.dev

Decode polyline points from Google Maps Directions API and Google Routes API.

$ flutter pub add flutter_polyline_points
Source repository

What it does

A Flutter package that retrieves and decodes geographic routes and polylines from Google's Directions and Routes APIs. It converts coordinate data and encoded strings into usable map points with support for different travel modes, waypoints, and route modifiers.

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

Use it when

  • You need to draw routes on Google Maps using data from the Google Directions or Routes API.
  • You want to process encoded polyline strings into geographical points.

Skip it when

  • You are using a mapping provider other than Google Maps or need offline routing capabilities.

Strengths

  • Supports both legacy Directions API and enhanced Google Routes API.
  • Provides built-in route modifiers, alternative routes, and multiple travel modes.
  • Includes convenience properties for distance and duration conversions.

Weaknesses

  • Depends on external Google APIs which require active billing and API keys.
  • Does not handle offline routing.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1

Requires a valid Google Cloud API key with Directions API and/or Routes API enabled.

import 'package:flutter_polyline_points/flutter_polyline_points.dart';

PolylinePoints polylinePoints = PolylinePoints(apiKey: "YOUR_API_KEY");

PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
  request: PolylineRequest(
    origin: PointLatLng(37.7749, -122.4194),
    destination: PointLatLng(37.3382, -121.8863),
    mode: TravelMode.driving,
  ),
);

Alternatives

Packages that do the same job and could replace flutter_polyline_points.

Works with

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