Skip to content

Removing Listeners

Listener objects can be removed when the application is no longer interested in receiving real-time updates. A listener (or all of them) should be removed from the same event handler object which they were added to. The following listener removal APIs are available:

Removing all listeners

The method removes all registered listeners for the delete event:

eventHandler.removeDeleteListeners();

The method below removes all listeners which process events for a specific where clause. The value of the whereClause argument must be the same as one in the addDeleteListener method:

eventHandler.removeDeleteListeners([String whereClause]);

Removing a specific listener

This method removes a listener identified by a callback function.

// for the class-based approach;
eventHandler.removeDeleteListener(void Function(T) callback);

// for the map-based approach:
eventHandler.removeDeleteListener(void Function(Map) callback);