addDocumentReplicationListener abstract method

FutureOr<ListenerToken> addDocumentReplicationListener(
  1. DocumentReplicationListener listener
)

Adds a listener to be notified of DocumentReplications performed by this replicator.

Because of performance optimization in the replicator, document replications need to be listened to before starting the replicator. If the listener is added after the replicator is started, the replicator needs to be stopped and restarted again to ensure that the listener will get the document replication events.

Adding a listener

If a Future is returned, the listener will only start listening after the Future has completed. Otherwise the listener is listening immediately after this method returns.

Removing a listener

The returned ListenerToken needs to be provided to removeChangeListener, to remove the given listener. Regardless of whether a Future is returned or not, the listener immediately stops being called.

See also:

Implementation

FutureOr<ListenerToken> addDocumentReplicationListener(
  DocumentReplicationListener listener,
);