onEvent method Null safety

Stream<String?> onEvent()

This method is called to register the listener events.

Events:

  • USER_KEY_CHANGED:

    If a user has multiple devices and changes the password on one online device, the cloud notifies other online devices of the password change.

Implementation

Stream<String?> onEvent() {
  try {
    return _onEventEventChannel.receiveBroadcastStream().map((dynamic s) {
      return s is String ? s : null;
    });
  } catch (e) {
    throw AGConnectCloudDBException._from(e);
  }
}