polyline_tools 0.0.2 copy "polyline_tools: ^0.0.2" to clipboard
polyline_tools: ^0.0.2 copied to clipboard

A Dart package for encoding and decoding Google Maps polylines.

example/main.dart

import 'package:flutter/material.dart';
import 'package:polyline_tools/lat_lng.dart';
import 'package:polyline_tools/polyline_tools.dart';

void main() {
  // Example usage of PolylineTools
  List<LatLng> coordinates = [
    LatLng(37.7749, -122.4194), // San Francisco
    LatLng(34.0522, -118.2437), // Los Angeles
  ];

  // Encode the coordinates to a polyline
  String encodedPolyline = PolylineTools.encodePolyline(coordinates);
  debugPrint('Encoded Polyline: $encodedPolyline');

  // Decode the polyline back to coordinates
  List<LatLng> decodedCoordinates = PolylineTools.decodePolyline(encodedPolyline);
  debugPrint('Decoded Coordinates: ${decodedCoordinates.map((latLng) => '(${latLng.latitude}, ${latLng.longitude})').join(', ')}');
}
2
likes
150
points
28
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package for encoding and decoding Google Maps polylines.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on polyline_tools