leaveGroup method

Future<void> leaveGroup(
  1. String groupId
)

~english Leaves a group. The group owner cannot leave, only can destroy the group.

Param groupId The group ID.

Returns None.

Throws Exception description, see EMError. ~end

~chinese 退出群组,群主不能退出群,只能销毁群。

Param groupId 群组 ID。

Return 无。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError. ~end

Implementation

Future<void> leaveGroup(String groupId) async {
  try {
    Map req = {'groupId': groupId};
    Map result = await Client.instance.groupManager
        .callNativeMethod(ChatMethodKeys.leaveGroup, req);
    EMError.hasErrorFromResult(result);
  } catch (e) {
    rethrow;
  }
}