readStream method

Stream<GroupChannel> readStream({
  1. String? channelUrl,
})

Returns a stream to listen read event with given channelUrl

It will be triggered every read event if channelUrl is not provided

Implementation

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

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