getChannel static method

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

Gets a GroupChannel with given channel URL.

Implementation

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

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