RouteListener class
Listener for events related to a computed route.
Receives asynchronous notifications produced by the routing/navigation runtime for a specific Route instance. Typical events include updates to route-related traffic, confirmation that traffic events along the route were checked, and debug notifications when the route's recorded track is trimmed during navigation.
Create a RouteListener with the factory constructor and attach it to a route via Route.routeListener to receive events for that route.
Example
final RouteListener routeListener = RouteListener(
onRouteTrafficEventsUpdated: (delayDiff) {
print('Traffic delay difference: $delayDiff s');
},
onTrafficEventsAlongRouteChecked: () {
print('Traffic events along route checked');
},
onRouteTrackTrimmed: () {
print('Route track trimmed');
},
);
route.routeListener = routeListener;
See also:
- RouteBase.routeListener — Attach or remove the RouteListener to a Route.
- NavigationService — Higher-level navigation helpers that emit related events.
Constructors
- RouteListener({void onRouteTrafficEventsUpdated(int delayDiff)?, void onTrafficEventsAlongRouteChecked()?, void onRouteTrackTrimmed()?})
-
Creates a RouteListener.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id ↔ dynamic
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → FutureOr< void> -
handleEvent(
Map arguments) → void - Method called when event is called from the native side.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOnRouteTrackTrimmed(
void callback()?) → void - Registers a callback invoked when the route's recorded track is trimmed.
-
registerOnRouteTrafficEventsUpdated(
void callback(int delayDiff)?) → void - Registers a callback invoked when traffic events affecting the route are updated.
-
registerOnTrafficEventsAlongRouteChecked(
void callback()?) → void - Registers a callback invoked when traffic events along the route have been checked by the SDK.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited