Remy Benza
02/03/2025, 1:49 PMRemy Benza
02/03/2025, 1:50 PMprivate fun listenToUpdate(user: User) {
supabaseClient
.from(USERS_DETAILS_TABLE)
.selectSingleValueAsFlow(User::userId) {
eq("userId", user.userId.orEmpty()) // listen for changes for this specific user
}
.catch { Timber.e(it, "Error inside flow for user details table") }
.filterNotNull()
.onEach {
Timber.tag("~!").d("flow table user details: ${it}")
user.value = it
}
.launchIn(scope)
Remy Benza
02/03/2025, 1:51 PMlistenToUpdate
function multiple times, will it then setup multiple listeners?Remy Benza
02/03/2025, 1:53 PMJan
02/03/2025, 1:59 PMselectSingleValueAsFlow
don't interact with each other, meaning you can call them how many times you want.Jan
02/03/2025, 2:01 PMRemy Benza
02/03/2025, 2:26 PMRemy Benza
02/03/2025, 2:27 PMvar realtimeJob = Job()
and thenRemy Benza
02/03/2025, 2:28 PMrealtimeJob?.cancel()
before assigning the new job to the var when calling listenToUpdate()
Jan
02/03/2025, 4:53 PMRemy Benza
02/04/2025, 8:44 AMJan
02/05/2025, 6:59 AM