createChannel method Null safety
- GroupChannelParams params,
- {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
.
Implementation
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)) {
params.userIds.add(currentUserId);
}
return sdk.api.createGroupChannel(params, progress: progress);
}