finish static method

Future<void> finish(
  1. bool closeWebUSB
)

Finish this session, also end WebUSB session if explicitly asked by user.

Implementation

static Future<void> finish(bool closeWebUSB) async {
  if (_deviceAvailable()) {
    if (closeWebUSB) {
      try {
        await (_device!.callMethod("close".toJS) as JSPromise<JSObject>)
            .toDart;
      } on Exception catch (e) {
        log.severe("Finish error: ", e);
        throw PlatformException(
          code: "500",
          message: "WebUSB API error",
          details: e,
        );
      }
      _device = null;
    }
  }
}