flutter_map_directions

Creator: coderz1093

Last updated:

Add to Cart

Description:

flutter map directions

flutter_map_directions #
A flutter_map plugin for displaying directions between coordinates.
Usage #
Add flutter_map_directions to your pubspec.yaml:
dependencies:
flutter_map_directions: any // or latest version
copied to clipboard
Add the layer widget into FlutterMap:
final DirectionController _directionController = DirectionController();

Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(
...
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
),
MarkerLayer(
...
),
DirectionsLayer(
coordinates: [],
controller: _directionController,
), // <-- add layer here
],
);
}
copied to clipboard
To update route:
void _loadRoute() async {
await <load_route_async_action>;
_coordinates = [...]; // new coordinates after awaiting
_directionController.updateDirection(_coordinates);
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.