To add androidx lifecycle bindings, import corbind-lifecycle
module:
dependencies {
implementation("ru.ldralighieri.corbind:corbind-lifecycle:1.11.0")
}
List of extensions
Component | Extension | Description |
---|---|---|
Lifecycle | events |
Called when any lifecycle event change. |
Simple examples
lifecycle.events() // Flow<Lifecycle.Event>
.filter { it == Lifecycle.Event.ON_RESUME }
.onEach { /* handle lifecycle onResume event */ }
.flowWithLifecycle(lifecycle)
.launchIn(lifecycleScope) // lifecycle-runtime-ktx
More examples in source code