I have a Firestore listener and when I induce an error by changing the security rules I get a permission-denied error printed out by onError, however I stop receiving any snapshot updates even though cancelOnError is set to false and I reverted the security rules. How to fix?
query
.snapshots(includeMetadataChanges: true)
.listen(
(snapshot) {
//stops being called after error occurs
},
onError: (error) {
//print error
},
cancelOnError: false,
)
The cancelOnError
property determines whether the client cancels the listener when an error occurs.
In this case though, it is the server that cancels the operation when an error occurs. There is no way to prevent this from happening, as this type of error typically indicates a programming mistake. You will have to fix the root cause, and re-attach the listener.