The
https://developer.android.com/reference/androidx/activity/OnBackPressedCallback
OnBackPressedDispatchercontrols how Back button events are dispatched to one or more
OnBackPressedCallbackobjects.
https://developer.android.com/reference/androidx/activity/OnBackPressedCallback
In Kotlin a "receiver" is the instance on which an extension function is defined, or the type for a lambda with receiver.
https://kotlinlang.org/docs/reference/annotations.html
https://kotlinlang.org/docs/reference/annotations.html
This media is not supported in your browser
VIEW IN TELEGRAM
We are finally getting the ability to animate Lazy list's item position changes in #JetpackCompose just like we did with DiffUtil π
The Modifier API called `Modifier.animateItemPlacement()` was implemented and merged and will probably be released in an upcoming Compose version.
The Modifier API called `Modifier.animateItemPlacement()` was implemented and merged and will probably be released in an upcoming Compose version.
Explain the difference between Cold Flow and Hot Flow with an example.
Cold Flow π₯Ά
β‘οΈ A cold flow is a data flow that produces values only when there is an active collector.
β‘οΈ Each collector receives the emitted values independently, and they start receiving emissions from the beginning when they subscribe.
β‘οΈ If we subscribe to a cold flow, we will receive all of the emitted values, even if the flow has already completed emitting values.
β When to use?
β‘οΈ Cold flows are typically used for tasks that need to be performed only once, such as loading data from a database or fetching data from a remote server.
β‘οΈ Example
Flow (itself)
Cold Flow π₯Ά
β‘οΈ A cold flow is a data flow that produces values only when there is an active collector.
β‘οΈ Each collector receives the emitted values independently, and they start receiving emissions from the beginning when they subscribe.
β‘οΈ If we subscribe to a cold flow, we will receive all of the emitted values, even if the flow has already completed emitting values.
β When to use?
β‘οΈ Cold flows are typically used for tasks that need to be performed only once, such as loading data from a database or fetching data from a remote server.
β‘οΈ Example
Flow (itself)
Hot Flow π₯
β‘οΈ A hot flow is a data flow that emits values regardless of whether there are active collectors. It can produce values even if there are no subscribers.
β‘οΈ New collectors joining a hot flow might miss emissions that occurred before they started listening.
β‘οΈ If we subscribe to a hot flow, we will start receiving emissions from the point where the flow is currently at. If the flow has already completed emitting values, we will not receive any emissions.
β When to use?
β‘οΈ Hot flows are typically used for tasks that need to be performed continuously, such as updating a Ul with real-time data.
β Example
StateFlow and SharedFlow
β‘οΈ A hot flow is a data flow that emits values regardless of whether there are active collectors. It can produce values even if there are no subscribers.
β‘οΈ New collectors joining a hot flow might miss emissions that occurred before they started listening.
β‘οΈ If we subscribe to a hot flow, we will start receiving emissions from the point where the flow is currently at. If the flow has already completed emitting values, we will not receive any emissions.
β When to use?
β‘οΈ Hot flows are typically used for tasks that need to be performed continuously, such as updating a Ul with real-time data.
β Example
StateFlow and SharedFlow