usb_device 0.0.2 copy "usb_device: ^0.0.2" to clipboard
usb_device: ^0.0.2 copied to clipboard

outdated

Flutter plugin for connecting/accessing usb device.

License: MIT pub dev webusb

WebUSB plugin #

Apparence.io logo

Developed with 💙  by Apparence.io

This plugin provide access to USB devices from web pages with WebUSB.

Platform Support #

Android iOS MacOS Web Linux Windows
✔️

Usage #

You can get wi-fi related information using:

import 'package:usb_device/usb_device.dart';

final UsbDevice usbDevice = UsbDevice();

var pairedDevices = await usbDevice.pairedDevices;
var pairedDevice = await usbDevice.requestDevices([DeviceFilter(vendorId : 0x00, productId: 0x00)]);
List<USBConfiguration> availableConfigurations = await usbDevice.getAvailableConfigurations(pairedDevice);
USBDeviceInfo deviceInfo = await usbDevice.getPairedDeviceInfo(pairedDevice);
await usbDevice.open(pairedDevice);
await usbDevice.close(pairedDevice);

Implementation #

USB #

  • getDevices() : Get paired attached devices
  • requestDevice(filters): pair a device with filter or not

USBDevice #

  • Get device info with configuration
  • open(): Start session
  • close(): Close session
  • selectConfiguration(configurationValue): Select a specified configuration
  • claimInterface(interfaceNumber): Claim an interface for exclusive access
  • releaseInterface(interfaceNumber): Release a claimed interface
  • controlTransferIn(setup, length): Return result of a command
  • controlTransferOut(setup, data) : Send a command to device
  • transferIn(): Return data from device
  • transferOut(): Send data to device
  • clearHalt()
  • reset(): Reset device
  • isochronousTransferIn()
  • isochronousTransferOut()

Events #

  • OnConnect
  • OnDisconnect