A flutter webusb plugin

  Plugin, plugin, web app

WebUSB plugin

Apparence.io logo

Developed with blue_heart  by Apparence.io

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

Platform Support

AndroidiOSMacOSWebLinuxWindows
heavy_minus_signheavy_minus_signheavy_minus_signheavy_check_markheavy_minus_signheavy_minus_sign

Usage

import 'package:usb_device/usb_device.dart';

final UsbDevice usbDevice = UsbDevice();

var pairedDevices = await usbDevice.pairedDevices; // get paired devices
var pairedDevice = await usbDevice.requestDevices([DeviceFilter(vendorId : 0x00, productId: 0x00)]); // par a device 
List<USBConfiguration> availableConfigurations = await usbDevice.getAvailableConfigurations(pairedDevice); // get device's configurations 
USBDeviceInfo deviceInfo = await usbDevice.getPairedDeviceInfo(pairedDevice); // get device's info
await usbDevice.open(pairedDevice); // start session
await usbDevice.close(pairedDevice); // close session

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

Download WebUSB plugin source code on GitHub