Daniel
07/31/2023, 7:56 PMappService.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:
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
}
how is it possible to be null?Claus Rørbech
08/01/2023, 6:56 AMappService.currentUser
should not be null
when a user has logged in. Are you referring to the UserInfo emitted by the above flow?
If you have an observation of appService.currentUser
being null after login, then please file an issue on our Realm Kotlin Github project with detailed context