quick_usb 0.2.0 quick_usb: ^0.2.0 copied to clipboard
A cross-platform USB plugin for Flutter
quick_usb #
A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter
Usage #
- List devices
- Check/Request permission
- Open/Close device
- Get/Set configuration
- Claim/Release interface
- Bulk transfer in/out
List devices #
await QuickUsb.init();
// ...
var deviceList = await QuickUsb.getDeviceList();
// ...
await QuickUsb.exit();
Check/Request permission #
Android Only
var hasPermission = await QuickUsb.hasPermission(device);
print('hasPermission $hasPermission');
// ...
await QuickUsb.requestPermission(device);
Open/Close device #
var openDevice = await QuickUsb.openDevice(device);
print('openDevice $openDevice');
// ...
await QuickUsb.closeDevice();
Get/Set configuration #
var configuration = await QuickUsb.getConfiguration(index);
print('getConfiguration $configuration');
// ...
var setConfiguration = await QuickUsb.setConfiguration(configuration);
print('setConfiguration $getConfiguration');
Claim/Release interface #
var claimInterface = await QuickUsb.claimInterface(interface);
print('claimInterface $claimInterface');
// ...
var releaseInterface = await QuickUsb.releaseInterface(interface);
print('releaseInterface $releaseInterface');
Bulk transfer in/out #
var bulkTransferIn = await QuickUsb.bulkTransferIn(endpoint, 1024);
print('bulkTransferIn ${hex.encode(bulkTransferIn)}');
// ...
var bulkTransferOut = await QuickUsb.bulkTransferOut(endpoint, data);
print('bulkTransferOut $bulkTransferOut');