RoutingManager class

Internal manager for calculating and drawing routes on the map.

Constructors

RoutingManager(MapLibreMapController _controller)

Properties

currentRoutes → List<PowerMapRouteResult>
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedRouteIndex → int
no setter

Methods

addRoute({required LatLng start, required LatLng destination, required List<LatLng> waypoints, required bool optimize, required String profile, required String language, bool fitCamera = true}) → Future<PowerMapRouteResult?>
Calculates and draws a route between start and destination.
addRouteWithAlternatives({required LatLng start, required LatLng destination, String profile = 'driving', String language = 'th', int maxAlternatives = 3, bool fitCamera = true}) → Future<PowerMapRoutesResult?>
Calculates multiple routes between start and destination using the Alternative Route API.
clearAlternativeRoutes() → Future<void>
Clears only the alternative route lines (used when starting navigation).
clearRoutes() → Future<void>
clearStepTurnArrows() → Future<void>
Clears step turn arrow data (sets empty GeoJSON). Layers stay alive for instant reuse.
disposeStepTurnArrows() → Future<void>
Fully removes step arrow layers and source. Call on route dismissal/disposal only.
drawRoutes(List<PowerMapRouteResult> routes, {int selectedIndex = 0, bool fitCamera = true}) → Future<void>
Renders multiple routes on the map.
drawSavedRoute(List<LatLng> geometry) → void
Redraws an existing geometry without calling the API again. Used for restoring the original path after stopping navigation.
drawStepTurnArrows({required List<PowerRouteStep> steps, required List<LatLng> routeGeometry, int? selectedStepIndex, int? currentStepIndex, int maxUpcomingCount = 3, double? distanceTraveled, double? zoom, String? belowLayerId}) → Future<void>
Renders compact white sub-polyline turn arrows focused tightly at turn corners (Google Maps Style). Mutex-serialized: if called while a previous draw is in progress, waits for it to finish first.
findNearestRouteIndex(LatLng tapLocation, {double maxDistanceMeters = 35.0, double? zoom, double touchRadiusPixels = 56.0}) → int
Finds the route index whose polyline is closest to tapLocation.
getRouteDivergentPoint(int routeIndex) → LatLng
Calculates the point along _currentRoutesrouteIndex that has the greatest separation from all other routes, ideal for placing on-map floating tooltips (Google Maps style).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
selectRoute(int index, {bool animateCamera = false}) → Future<void>
Changes the active/selected route to index and redraws the layers accordingly.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited