channelChangedStream method

Stream<BaseChannel> channelChangedStream({
  1. String? channelUrl,
})

Returns a stream to listen channel change event with given channelUrl

It will be triggered every channel chaange if channelUrl is not provided

Implementation

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

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