web_hid 0.1.0 copy "web_hid: ^0.1.0" to clipboard
web_hid: ^0.1.0 copied to clipboard

outdated

A starting point for Dart libraries or applications.

Dart wrapper via dart:js for https://wicg.github.io/webhid/

Features #

  • canUseHid
  • getDevices/requestDevice
  • open/close
  • sendFeatureReport

Usage #

canUseHid #

bool canUse = canUseHid();
print('canUse $canUse');

getDevices/requestDevice #

List<HidDevice> getDevices = await hid.getDevices();
_device = getDevices[0];
List<HidDevice> requestDevice = await hid.requestDevice(RequestOptions(
  filters: [keyboardBacklightIds],
));
_device = requestDevice[0];

open/close #

_device?.open().then((value) {
  print('device.open success');
}).catchError((error) {
  print('device.open $error');
});
_device?.close().then((value) {
  print('device.close success');
}).catchError((error) {
  print('device.close $error');
});

sendFeatureReport #

_device?.sendFeatureReport(1, Uint32List.fromList([1, 0])).then((value) {
  print('device.sendFeatureReport 0 success');
}).catchError((error) {
  print('device.sendFeatureReport $error');
});

Additional information #

Status in Chromium: https://chromestatus.com/feature/5172464636133376

1
likes
0
pub points
55%
popularity

Publisher

verified publisherwoodemi.com

A starting point for Dart libraries or applications.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

js

More

Packages that depend on web_hid