joinPublicGroup method

Future<void> joinPublicGroup(
  1. String groupId
)

~english Joins a public group.

For a group that requires no authentication,users can join it freely without obtaining permissions from the group owner. For a group that requires authentication, users need to wait for the group owner to agree before joining the group. For details, See EMGroupStyle.

Param groupId The group ID.

Throws A description of the exception. See EMError. ~end

~chinese 当前登录用户加入公开群。

若是自由加入的公开群,直接进入群组;若公开群需验证,群主同意后才能入群。详见 EMError

Param groupId 群组 ID。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。 ~end

Implementation

Future<void> joinPublicGroup(
  String groupId,
) async {
  Map req = {'groupId': groupId};
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.joinPublicGroup, req);
  try {
    EMError.hasErrorFromResult(result);
  } on EMError catch (e) {
    throw e;
  }
}