observeResults

inline fun <T : Any> ResultSource.observeResults(): Flow<Consumable<T>>

Observes results of type T, delivered after BackDestination is handled. Every result is wrapped into Consumable: it is removed from the store once consumed and cannot be consumed twice.

Results are matched by runtime class, so generic type arguments are erased. Results are broadcast to every active collector of T, so observation must be scoped to the lifecycle of the destination, which expects the result (usually a ViewModel). Keeping a collector active for a destination, which is not current, is an implementation error.

Pending results are cleared when a new destination is pushed onto the same backstack and expire after the configured TTL (DEFAULT_RESULT_TTL by default). Results are held in memory only: pending results are dropped on process death and are not persisted by net.zagart.navigation.controller.NavigationControllerSaver.