AndroidDev, Android App Development, Android, Jetpack, Jetpack Compose.
will create a networkStatus property in ViewModel from where Compose UI will collect it. Exposing a property in ViewModel will look like below. Flow.StateIn operator is used to convert callbackFlow into StateFlow . NetworkConnectivityService will be injected as dependency inside the ViewModel