leave method

Future<void> leave({
  1. HMSActionResultListener? hmsActionResultListener,
})

Call this method to leave the room HMSActionResultListener callback will be used by SDK to inform the application if there was a success or failure when the leave was executed

Refer leave guide here.

Implementation

Future<void> leave({HMSActionResultListener? hmsActionResultListener}) async {
  var result = await PlatformService.invokeMethod(PlatformMethod.leave);
  if (hmsActionResultListener != null) {
    if (result == null) {
      hmsActionResultListener.onSuccess(
          methodType: HMSActionResultListenerMethod.leave);
    } else {
      hmsActionResultListener.onException(
          methodType: HMSActionResultListenerMethod.leave,
          hmsException: HMSException.fromMap(result["error"]));
    }
  }
}