Wednesday, November 20, 2024

CoroutineScope : Android

    CoroutineScope : Android

  • Lifescycle scope
  • Global Scope
  • ViewmodelScope (Custom Scope )

Lifescycle scope

Use lifecycle-aware scopes like lifecycleScope or viewLifecycleOwner.lifecycleScope provided by Jetpack's Lifecycle library to automatically manage coroutine lifecycles.


Global Scope

Global scope alive till application running

Viewmodel Scope


Viewmodel scope will alive till activity or fragment

can able to use multiple fragment or activity.




Tuesday, November 12, 2024

What are Scope functions in kotlin?

 Below example for list scope function in kotlin 


  • let
  • run
  • with
  • apply
  • also

let

 The basic functionality of all the scope functions is the same i.e. to execute a block of code on an object.




Check out this may be help you

Related Posts Plugin for WordPress, Blogger...