getChannel static method

Future<OpenChannel> getChannel(
  1. String channelUrl,
  2. {Chat? chat}
)

Gets a OpenChannel with given channel URL.

Implementation

static Future<OpenChannel> getChannel(
  String channelUrl, {
  Chat? chat,
}) async {
  sbLog.i(StackTrace.current, 'channelUrl: $channelUrl');
  chat ??= SendbirdChat().chat;

  final channel = chat.channelCache.find<OpenChannel>(channelKey: channelUrl);
  if (channel != null && !channel.dirty) {
    channel.fromCache = true;
    return channel;
  }

  return await OpenChannel.refresh(channelUrl, chat: chat);
}