setClientListeners method
void
setClientListeners()
Implementation
void setClientListeners() {
// Remove any existing listeners
if (_removeClientListeners != null) {
_removeClientListeners?.call();
_removeClientListeners = null;
}
final unsubError = client.subscribeToError(_handleClientError);
final unsubRelations = client.subscribeToRelations(_handleClientRelations);
final unsubTransactions =
client.subscribeToTransactions(_handleClientTransactions);
final unsubAdditionalData =
client.subscribeToAdditionalData(_handleClientAdditionalData);
final unsubOutboundStarted =
client.subscribeToOutboundStarted(_handleClientOutboundStarted);
final unsubGoneBatch = client.subscribeToGoneBatch(_applyGoneBatch);
final subscriptionsListeners = client.subscribeToSubscriptionEvents(
_handleSubscriptionData,
_handleSubscriptionError,
);
// Keep a way to remove the client listeners
_removeClientListeners = () {
unsubError();
unsubRelations();
unsubTransactions();
unsubAdditionalData();
unsubOutboundStarted();
unsubGoneBatch();
subscriptionsListeners.removeListeners();
};
}