findDevices method

Finds USB devices specified by the vendor, product and (optionally) interface IDs and if permissions allow opens them for use.

If the access request is rejected or the device fails to be opened a connection handle will not be created or returned.

Calling this method is equivalent to calling getDevices followed by openDevice for each device.

|options|: The properties to search for on target devices.

Implementation

Future<List<ConnectionHandle>> findDevices(
    EnumerateDevicesAndRequestAccessOptions options) async {
  var $res = await promiseToFuture<JSArray>(
      $js.chrome.usb.findDevices(options.toJS));
  return $res.toDart
      .cast<$js.ConnectionHandle>()
      .map((e) => ConnectionHandle.fromJS(e))
      .toList();
}