createChannel method Null safety

Future<GroupChannel> createChannel(
  1. GroupChannelParams params,
  2. {OnUploadProgressCallback? progress}

Creates a channel with given params.

After this method completes successfully, channel event such as ChannelEventHandler.onUserJoined, ChannelEventHandler.onUserReceivedInvitation and/or ChannelEventHandler.onChannelOperatorsUpdated can be invoked based on the given params.


static Future<GroupChannel> createChannel(
  GroupChannelParams params, {
  OnUploadProgressCallback? progress,
}) async {
  final sdk = SendbirdSdk().getInternal();
  final currentUserId = sdk.state.userId ?? '';
  if (params.userIds.isEmpty) {
    params.userIds = [currentUserId];
  } else if (!params.userIds.contains(currentUserId)) {
  return sdk.api.createGroupChannel(params, progress: progress);