Super simple question. I need to remove a firestore snapshot listener once I hit a certain point inside of my listener. Seems like this should be super easy but I can't figure it out. Thanks!
Example code:
val registration = gameRef.addSnapshotListener { snapshot, e ->
//code....
//if(condition is meet){
// destroy this listener
//}
}
Assume that the listener is returned immediately and that its callback won't be invoked until after it's returned by the function:
var feedback: ListenerRegistration? = null
feedback = gameRef.addSnapshotListener { snapshot, e ->
feedback?.remove()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With