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