BetterRoutePromptViewModel

Manages the display and interaction with better route suggestions during navigation. Provides information about alternative routes and handles user responses to these suggestions.

Thread Safety

This ViewModel is not thread-safe and must only be accessed from the Main thread.

  • All methods must be called from the Main (UI) thread

  • All StateFlow properties emit values on the Main thread

  • Concurrent access from multiple threads may lead to undefined behavior

Inheritors

Properties

Link copied to clipboard
abstract val betterRoutePrompt: StateFlow<BetterRoutePrompt?>

Observable state of the current better route suggestion. Null when no better route is available.

Link copied to clipboard
abstract val dismissalProgress: StateFlow<Double>

Observable state of the dismissal progress (0.0 to 1.0).

Functions

Link copied to clipboard
abstract fun accept()

Accepts the suggested better route and switches navigation to it.

Link copied to clipboard
abstract fun onCleared()

Releases resources when the view model is no longer needed.

Link copied to clipboard
abstract fun reject()

Rejects the suggested better route and continues with the current route.