UsbSerial class
UsbSerial is the main entry point into this class and can create UsbPorts or list devices.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
usbEventStream
→ Stream<
UsbEvent> ? -
Use this stream to detect if a USB device is plugged in or removed.
no setter
Static Methods
-
create(
int vid, int pid, [String type = "", int interface = -1]) → Future< UsbPort?> - Creates a UsbPort from vid, pid and optionally type and interface. throws an error on failure. This function will pop up a permission request if needed.
-
createFromDeviceId(
int? deviceId, [String type = "", int interface = -1]) → Future< UsbPort?> - Creates a UsbPort from deviceId optionally type and interface. throws an error on failure. This function will pop up a permission request if needed. Note deviceId is only valid for the duration of a device being plugged in. Once unplugged and replugged this id changes.
-
listDevices(
) → Future< List< UsbDevice> > - Returns a list of UsbDevices currently plugged in.
Constants
- CDC → const String
- CDC class constant. Very common USB to UART bridge type. Used by create
- CH34x → const String
- CH34X hardware type. Used by create
- CP210x → const String
- CP210x hardware type. Used by create
- FTDI → const String
- FTDI Hardware USB to Uart bridge. (Very common) Used by create
- PL2303 → const String
- PL2303 Hardware USB to Uart bridge. (Fairly common) Used by create