Fetching location updates using Kotlin Flow
Dealing with FusedLocationProviderClient, LocationRequest and LocationCallback classes when you need to fetch the current user location can be cumbersome. You don’t want to add this logic to the ViewModel because you will get stub exceptions when running unit tests (and generally, it’s bad practice). Do you add it to the activity/fragment, and then pass the data to the ViewModel? What happens if you need the location in another activity/fragment? This can get messy quick.