https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Daniel

03/02/2023, 9:30 AM
Hello, I am trying to get user data and add a FCM token to the user after the login. The method on the repo shared:
Copy code
suspend fun getUserProfileAndInsertFCMTokenForIOS(token: String): CommonFlow<UserInfo?> {
    val userId = appService.currentUser!!.id


    val userdata = realm.query<UserInfo>("_id = $0", userId).asFlow().map {
        it.list.firstOrNull()
    }.asCommonFlow()

    realm.write {
            var user = query<UserInfo>("_id = $0", userId).first().find()
            if (user != null) {
                user = findLatest(user)!!.also {
                    if (!it.FCMToken.contains(token)) it.FCMToken.add(token)
                }
                copyToRealm(user)
            }
        }


    return userdata
}
When I call after the login, I am getting: _*'async' call in a function that does not support concurrency*_: Here:

https://files.slack.com/files-pri/T09229ZC6-F04S0HTCAF5/screenshot_2023-03-02_at_11.28.15.png