How it is possible that the current user `appServi...
# realm
d
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
    }
how is it possible to be null?
c
The
appService.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