getDevices method
Implementation
@override
Future<List<UsbDevice>> getDevices() async {
try {
final device = await usb.requestDevice(
RequestUSBDeviceFilters.dart(
[RequestUSBDeviceFilter(vendorId: _ledgerVendorId)],
),
);
if (device == null) {
return [];
}
final devices = await usb.getDevices();
_foundDevices
..clear()
..addAll(devices);
return devices
.map((e) => UsbDevice(
manufacturerName: e.manufacturerName,
deviceId: 0,
vendorId: e.vendorId,
productId: e.productId,
productName: e.productName,
configurationCount: 0,
identifier: e.serialNumber,
deviceName: e.productName,
))
.toList();
} catch (e) {
debugPrint('Error in getDevices: $e');
return [];
}
}