Hello everyone!
How it is possible that the current user
appService.currentUser
is null for some users after they already login?
this will cause the app to crash because I really dont know a good way or flow to handle when it is null, I dont even know how its possible to be null, because I do not delete the users nor the token refresh expires.
the code:
Copy code
fun getUserProfile(): CommonFlow<UserInfo?> {
val userId = appService.currentUser!!.id
val user = realm.query<UserInfo>("_id = $0", userId).asFlow().map {
it.list.firstOrNull()
}.asCommonFlow()
return user
}