endRoom method
Future<void>
endRoom({
- required bool lock,
- required String reason,
- HMSActionResultListener? hmsActionResultListener,
Remove all the peers from the room & end the room.
Parameters:
reason - reason
is the reason why the room is being ended.
lock - lock
bool is whether rejoining the room should be disabled for the foreseeable future.
hmsActionResultListener - hmsActionResultListener
is the callback that would be called by SDK in case of success or failure
Refer endRoom guide here
Implementation
Future<void> endRoom(
{required bool lock,
required String reason,
HMSActionResultListener? hmsActionResultListener}) async {
var arguments = {"lock": lock, "reason": reason};
var result = await PlatformService.invokeMethod(PlatformMethod.endRoom,
arguments: arguments);
if (hmsActionResultListener != null) {
if (result == null) {
hmsActionResultListener.onSuccess(
methodType: HMSActionResultListenerMethod.endRoom,
arguments: arguments);
} else {
hmsActionResultListener.onException(
arguments: arguments,
methodType: HMSActionResultListenerMethod.endRoom,
hmsException: HMSException.fromMap(result["error"]));
}
}
}