Search packages, repositories and app categories

Package detailsv0.3.23+2

libusb

Dart wrapper via `dart:ffi` for https://github.com/libusb/libusb

macOSWindowsLinux
30-day downloads
41
Likes
28
Pub points
125

Install package

flutter pub add libusb

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Dart wrapper using `dart:ffi` that provides access to the libusb library, enabling low-level USB device communication on desktop platforms. This package allows Flutter applications to interact directly with USB hardware, such as reading from or writing to connected devices, managing device descriptors, and handling USB transfers. It is ideal for developers building desktop apps requiring direct hardware control. The wrapper is platform-agnostic across macOS, Windows, and Linux, leveraging native libusb functionality through FFI for performance and compatibility.

Use cases

  • Accessing USB devices in desktop apps
  • Reading/writing data to USB peripherals
  • Developing hardware control software
  • Creating device drivers for custom USB hardware
  • Interfacing with scientific or industrial USB devices

Key features

  • Native performance via `dart:ffi`
  • Cross-platform support (macOS, Windows, Linux)
  • Direct USB device communication
  • Low-level control over USB endpoints
  • Supports asynchronous USB transfers

Suitable for

  • Desktop application developers
  • Hardware interface projects
  • IoT device management
  • Embedded systems with USB connectivity
  • Applications requiring real-time USB data exchange

Considerations

  • Requires native libusb libraries to be installed
  • Limited to desktop platforms
  • Complex setup for non-technical users
  • Error handling requires understanding of USB protocols
  • May need elevated permissions on some systems

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

libusb

Dart wrapper via dart:ffi for https://github.com/libusb/libusb

Environment

  • Windows(10)
  • macOS
  • Linux(Ubuntu 18.04 LTS)

Usage

Checkout example

Features and bugs

Please file feature requests and bugs at the issue tracker.

Build

Prepare llvm(9+)
  • Windows: winget install -e --id LLVM.LLVM
  • macOS: brew install llvm
  • Linux: sudo apt install libclang-10-dev
Build libusb_xxx.dart
  • Windows/Linux:
pub run ffigen
move lib/libusb.dart lib/libusb64.dart

Refactor timeval to timeval64

  • macOS:
pub run ffigen
mv lib/libusb.dart lib/libusb32.dart

Refactor timeval to timeval32

Contribute

Prepare libusb.h

Download xxx verion from https://github.com/libusb/libusb/releases and extract libusb.h

Prepare libusb-1.0 dynamic library
  • Windows:

Download xxx version from https://github.com/libusb/libusb/releases and extract

copy libusb-1.0.23\MS64\dll\libusb-1.0.dll libusb-1.0\
  • macOS:

Download xxx version from https://homebrew.bintray.com/bottles/libusb-1.0.23.catalina.bottle.tar.gz and extract

cp libusb/1.0.23/lib/libusb-1.0.dylib libusb-1.0/
  • Linux:

Download xxx version from http://old.kali.org/kali/pool/main/libu/libusb-1.0/ and install

cp /lib/x86_64-linux-gnu/libusb-1.0.so.0.xxx libusb-1.0/libusb-1.0.so

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.