joinChatRoom method
~english Joins the chat room.
To exit the chat room, call leaveChatRoom.
Param roomId
The ID of the chat room to join.
Param leaveOtherRooms
Whether to leave other rooms.
Param ext
The extension information.
Throws A description of the exception. See ChatError
.
~end
~chinese 加入聊天室
退出聊天室,调用 leaveChatRoom.
Param roomId
要加入的聊天室ID。
Param leaveOtherRooms
是否离开其他聊天室。
Param ext
扩展信息。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError
。
~end
Implementation
Future<void> joinChatRoom(
String roomId, {
bool leaveOtherRooms = false,
String? ext,
}) async {
Map result = await _channel.invokeMethod(ChatMethodKeys.joinChatRoom, {
"roomId": roomId,
"leaveOtherRooms": leaveOtherRooms,
"ext": ext ?? "",
});
try {
ChatError.hasErrorFromResult(result);
} on ChatError catch (e) {
throw e;
}
}