changeOwner method

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

~english Transfers the chat room ownership.

Only the chat room owner can call this method.

Param roomId The chat room ID.

Param newOwner The ID of the new chat room owner.

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

~chinese 转移聊天室的所有权。

仅聊天室所有者可调用此方法。

Param roomId 聊天室 ID。

Param newOwner 新的聊天室所有者 ID。

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

Implementation

Future<void> changeOwner(
  String roomId,
  String newOwner,
) async {
  Map req = {"roomId": roomId, "newOwner": newOwner};
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.changeChatRoomOwner, req);
  try {
    EMError.hasErrorFromResult(result);
  } on EMError catch (e) {
    throw e;
  }
}