changeOwner method

Future<void> changeOwner(
  1. String groupId,
  2. String newOwner
)

~english Changes the group owner. Only the group owner can call this method.

Param groupId The group ID. Param newOwner The new group owner.

Returns None.

Throws Exception description, see EMError. ~end

~chinese 转让群主。 仅群主有权限调用。

Param groupId 群组 ID。 Param newOwner 新群主。

Return 无。

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

Implementation

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