cancelPreview method

Future cancelPreview()

Cancel the Previewing for Role invocation. If a previewForRole call was performed previously then calling this method clears the tracks created anticipating a Change of Role This method only needs to be called if the user declined the request for role change.

This returns an object of Future

Refer the cancelPreview guide here

Implementation

Future<dynamic> cancelPreview() async {
  var result =
      await PlatformService.invokeMethod(PlatformMethod.cancelPreview);

  if (result["success"]) {
    return null;
  } else {
    return HMSException.fromMap(result["data"]["error"]);
  }
}