Code Monkey home page Code Monkey logo

flutter_polyline_points's Introduction

flutter_polyline_points

A flutter plugin that decodes encoded google polyline string into list of geo-coordinates suitable for showing route/polyline on maps

Getting Started

This package contains functions to decode google encoded polyline string which returns a list of co-ordinates indicating route between two geographical position

Usage

To use this package, add flutter_polyline_points as a dependency in your pubspec.yaml file.

Import the package

import 'package:flutter_polyline_points/flutter_polyline_points.dart';

First method

Get the list of points by Geo-coordinate, this return an instance of PolylineResult, which contains the status of the api, the errorMessage, and the list of decoded points.

PolylinePoints polylinePoints = PolylinePoints();
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(googleAPiKey,
        _originLatitude, _originLongitude, _destLatitude, _destLongitude);
print(result.points);

Second method

Decode an encoded google polyline string e.g _piFps|U_ulLnnqC_mqNvxq`@

List<PointLatLng> result = polylinePoints.decodePolyline("_p~iF~ps|U_ulLnnqC_mqNvxq`@");
print(result);

Third method

Fetch polyline with alternative routes. This method returns a list of PolylineResult

List<PolylineResult> resulte = await PolylinePoints().getRouteWithAlternatives(googleAPiKey,
        _originLatitude, _originLongitude, _destLatitude, _destLongitude);
print(results.length);

See the example directory for a complete sample app

Hint

kindly ensure you use a valid google api key,
If you need help generating api key for your project click this link

flutter_polyline_points's People

Contributors

dammyololade avatar bhavin-concetto avatar charlesarchibong avatar tuxbook avatar hadi20sa avatar a-k-o-r-e-d-e avatar enzoseason avatar maheshmnj avatar nnadir35 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.