graphhooper_route_navigation 0.0.8 graphhooper_route_navigation: ^0.0.8 copied to clipboard
A new plugin for GraphHooper route navigation. Use Mapbox Map as a base layer & map styles and Graphhooper Map route navigation data for polyline, duration and time.
graphhooper_route_navigation #
A new plugin for map route navigation.
Getting Started #
Introduction #
A new plugin for map route navigation. Use Maplibre Map as a base layer & map styles and Graphhooper Map route navigation data for polyline, duration and time and Getx for state managemet.
Setting up #
Android #
Add these permissions to the AndroidManifest.xml and grant location permission
Add the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in the application manifest android/app/src/main/AndroidManifest.xml to enable location features in an Android application:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
IOS This plugin is yet to test on iOS device.
How to use? #
Import package: #
import 'package:graphhooper_route_navigation/graphhooper_route_navigation.dart';
MaterialButton(
onPressed: () async{
ApiRequest apiRequest = ApiRequest();
DirectionRouteResponse directionRouteResponse = await apiRequest.getDrivingRouteUsingGraphHooper(
source: userLocation!.position,
destination: latLng,
//optional [customBaseUrl]
customBaseUrl:dotenv.env["CUSTOM_BASE_URL"] ,
navigationType: NavigationProfile.car,
// api key is optional if you use your own custom url
// if you are using graphhooper map routing service then [graphHooperApiKey] is needed to fetch route data
graphHooperApiKey: dotenv.env["API_KEY"] ?? "Your GraphHooper API key"
);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NavigationWrapperScreen(
directionRouteResponse: directionRouteResponse),
));
},
child: Text('Navigate'),
)