Рет қаралды 7,070
Learn Jetpack Compose in Android. In this video, we'll be discussing about RememberUpdatedState composable. Although it is not a side effect but as a utility function to provide the updated value of the state. While running an asynchronous operation, we want to have updated value of the state to be used across. For this we need, this function that will provide the latest value of the state. We have used an example here where coroutine is launched using Launched Effect. In this coroutine scope, we executed an asynchronous task - once the task is completed we might need to use the state value. There is a possibility of using state value in this case - we need to have some way to get the latest value of the state. For this we need this special function - rememberUpdatedState. It will always provide the latest value of the state.
Although Launched Effect can be made to re-trigger if we change the key but running a computation intensive asynchronous function will be an overhead. To prevent that from happening we can use this function and still get the latest value of the state. In simple words, to get the updated state after the asynchronous operation, we use this function in jetpack compose. Learn how to define composables using best practices. Everything is explained in Hindi (हिन्दी)
Topics covered -
1. RememberUpdatedState in Jetpack Compose.
2. Launched Effect with RememberUpdatedState example.
3. Asynchronous Operations in Jetpack Compose as a side effect using Launched Effect.
4. Examples of RememberUpdatedState with Splash Screen Implementation.
Kotlin Flows Playlist -
• Kotlin Flows Tutorials
Jetpack Paging Tutorial -
• Android Paging 3 | Jet...
Complete Dependency Injection Playlist Link -
• Dagger 2 - Dependency ...
Complete Android Architecture Components Playlist -
• Android Architecture C...
Beginner series in Android Playlist (Hindi) -
• Android Tutorials Step...
Kotlin Beginners Tutorial Series -
• Kotlin Beginner Tutori...
For more info - visit the below link
www.cheezycode.com
We are social. Follow us at -
Facebook - / cheezycode
Twitter - / cheezycode
Instagram - / cheezycode