AndroidDev, Android App Development, Android, Jetpack, Jetpack Compose.
using trySend . As mentioned before callbackFlow provides awaitClose block to unregister for the network changes. awaitClose will be called when callbackFlow is closed so we need to unregister for listeners. flowOn(Dispatchers.IO) is to make sure that calling networkStatus is main safe because we