TrafficLineController class

Controller for managing traffic information and route progress visualization.

This controller handles:

  • Route progress tracking
  • Traffic speed conditions
  • Road events monitoring (accidents, roadworks)
  • Intermediate route points
  • Dynamic route updates

The controller maintains real-time information about traffic conditions and route progress through TrafficLineModel.

Usage example:

final controller = TrafficLineController(
  navigationManager: navigationManagerInstance,
);

// Access current traffic information
print(controller.state.value.routeProgress);
print(controller.state.value.speedColors);

// Listen to traffic and route updates
controller.state.addListener(() {
  final model = controller.state.value;
  print('Route progress: ${(model.routeProgress * 100).toStringAsFixed(1)}%');
  print('Road events: ${model.roadEvents.length}');
});

The controller maintains three main subscriptions:

  • Route information updates
  • Route position updates
  • Dynamic traffic information updates

Remember to dispose of the controller when it's no longer needed:

controller.dispose();

Constructors

TrafficLineController({required NavigationManager navigationManager})

Properties

hashCode int
The hash code for this object.
no setterinherited
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ValueNotifier<TrafficLineModel>
The current state of traffic information as a ValueNotifier. Contains route progress, traffic conditions, and road events.
no setter

Methods

dispose() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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