Skip to content

Instantly share code, notes, and snippets.

@manuelvicnt
Created May 3, 2021 12:11
class UserRepository(
private val userEventsDataSource: FirestoreUserEventDataSource
) {
// New collectors will register as a new callback in Firestore.
// As this function depends on a `userId`, the flow cannot be
// reused by calling shareIn or stateIn in this function.
// That will cause a new Shared/StateFlow to be created
// every time the function is called.
fun getUserEvents(userId: String): Flow<UserEventsResult> =
userLocalDataSource.getObservableUserEvents(userId)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment