messageUpdateStream method Null safety

Stream<BaseMessage?> messageUpdateStream(
  1. {String? channelUrl}
)

Retruns a stream to listen message update event with given channelUrl.

It will be triggered every message update if channelUrl is not provided.

Implementation

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

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