# routing_client_dart 1.0.8

Dart Package for Routing Client Api ( support OSRM/Valhalla project )




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'routing_client_dart:1.0.8'
```
Published: 2025-09-15T06:54:35.074522Z
Expected archive SHA-256: 0aa44f6a451dbb7ac1f9a960520504f7bc1a9721ca4097e5b279dcc75531c89e

Available in cache; verification: upstream_checksum
## Direct dependencies
- dio: >=5.6.0
- fixnum: ^1.1.0

## Package README (untrusted upstream documentation)
## Routing Client Dart Package
![pub](https://img.shields.io/badge/pub-v1.0.8-blue)


> Package for osm routing client api 

> we support routing API for osrm-backend

> also Valhalla Route API (more APIs will be added )

> openrouteservice (coming soon)

> from 1.0.0 instruction will be included directly when requesting the route

> you can use our osrm service or valhalla service directly insteado of our RoutingManager

### client api support

* OSRM Client Api 
  * route service
  * trip service
* Valhalla Client
  * route service API

## Installing

Add the following to your `pubspec.yaml` file:

    dependencies:
      routing_client_dart: ^1.0.7


### example for osrm route service

```dart
    List<LngLat> waypoints = [
      LngLat(lng: 13.388860, lat: 52.517037),
      LngLat(lng: 13.397634, lat: 52.529407),
      LngLat(lng: 13.428555, lat: 52.523219),
    ];
    final manager = RoutingManager();
    final route = await manager.getRoute(
      OSRMRequest.route(
        waypoints: waypoints,
        geometries: Geometries.polyline,
        steps: true,
        languages: Languages.en,
      )
    );
```

### example for osrm trip service

```dart
    List<LngLat> waypoints = [
      LngLat(lng: 13.388860, lat: 52.517037),
      LngLat(lng: 13.397634, lat: 52.529407),
      LngLat(lng: 13.428555, lat: 52.523219),
    ];
    final manager = RoutingManager();
    final road = await manager.getRoute(
      OSRMRequest.trip(
        waypoints: waypoints,
        destination: DestinationGeoPointOption.last,
        source: SourceGeoPointOption.first,
        geometries: Geometries.polyline,
        steps: true,
        languages: Languages.en,
        roundTrip:false,
      )
    );
```

### example for check Location in Road

```dart
final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
    final isOnPath =
await roadManager.isOnPath(road, currentLocation, tolerance: 5);
```

### Example to get next navigation instruction of current Location



```dart
final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
    final isOnPath =
final instruction = await roadManager.nextInstruction(instructions, road, currentLocation, tolerance: 5);

```
**Warning** the precision of `LngLat` should be 5 if the road contain `polylineEncoded`, or the same precies as `LngLat` in `polylines`

**Note** you can get some inaccurate information `nextInstruction`,for that we will be happy for yours contributions

**Note** you can get voice instruction for valhalla instruction

**Note** more documentation will be added to soon

## Changelog
## 1.0.8:
* fix bug in getRoute alternatives (#30)
## 1.0.7:
* remove isolate to support wasm
* bump dart sdk to 3.7
## 1.0.6:
* fix nextInstruction implementation
* decode geometry in osrm road if geometry as given is string
## 1.0.5:
* fix copy instruction in getOSRMRoad #26
## 1.0.4:
* improve internally osrm_service,valhalla_service
## 1.0.3:
* change the name RoadType to `RoutingType`
## 1.0.2:
* export route model 
## 1.0.1: 
* forget to export OSRMRequest & ValhallaRequest
## 1.0.0: add valhalla route API
* break changes:
    * replace OSRMManager with RoutingManager
    * replace getRoad with getRoute
    * remove buildInstruction ( becone integrated automatically with route object )
    * replace Road by Route
    * replace return of OSRM api to OSRMRoad
* create OSRMService for osrm apis
* create ValhallaService for valhalla apis

## 0.5.5: fix bug
* fix bug related to generate path for getRoute
## 0.5.4:
* remove unnecessary dependency
* add check for nullable in road for attribute geometry
* thanks for @eshjordan, @derklaro  for their contribution 
## 0.5.3:
* add destinations to get all destination from road
## 0.5.2:
* remove some unnecessary files
## 0.5.1:
* fix bug
## 0.5.0: 
* add `isOnPath`,`nextInstruction` in OSRMManager
* support new languages for instructions
## 0.4.3: fix bug #16
* fix compute `parseRoad`in mobile platform
## 0.4.2: fix bugs
* fix load json for instructionsHelper
## 0.4.1: fix bugs
* fix uninitialized dio in OSRMManager default constructor
* remove instructions from road classes
## 0.4.0: re-implementation for buildInstruction
## 0.3.2: update dependency
## 0.3.1:
* fix parse route when configure geometry to geojson
* add new attribute polyline
## 0.3.0+1:
* fix parse data
## 0.3.0: trip service
* add new method `getTrip` that implement req call to trip service for osrm
## 0.2.0:  
* add get route alternatives inside road
## 0.1.1: fix parse json
* fix parse duration value from road json
## 0.1.0:
* support osrm client
* add example in readme






 
