scanUsbDevice method Null safety

  1. @override
Future<List<UsbDevice>?> scanUsbDevice()
override

扫描USB设备

Implementation

@override
Future<List<UsbDevice>?> scanUsbDevice() async {
  return methodChannel
      .invokeMethod(PluginConstants.methodScanUsbDevice)
      .then((value) {
    return proto.UsbDeviceList.fromBuffer(value)
        .items
        .map((e) => UsbDevice.fromProto(e))
        .toList();
  });
}