messageDeleteStream method Null safety

Stream<int?> messageDeleteStream(
  1. {String? channelUrl}
)

Returns a stream to listen messsage delete event with given channelUrl.

It will be triggered every message deletion if channelUrl is not provided

Implementation

Stream<int?> messageDeleteStream({String? channelUrl}) async* {
  if (currentUser == null) throw ConnectionRequiredError();

  await for (final res in _int.streamManager.msgDeletd.stream) {
    if (channelUrl != null) {
      if (res.channel.channelUrl == channelUrl) yield res.deletedId;
    } else {
      yield res.deletedId;
    }
  }
}