MethodChannelFlutterUsbSerialManager class
An implementation of FlutterUsbSerialManagerPlatform that uses method channels.
- Inheritance
-
- Object
- PlatformInterface
- FlutterUsbSerialManagerPlatform
- MethodChannelFlutterUsbSerialManager
Constructors
Properties
- eventChannel → EventChannel
-
The event channel the native side pushes interval-read data on.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- methodChannel → MethodChannel
-
The method channel used to interact with the native platform.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
serialDataStream
→ Stream<
String> -
Raw bytes pushed by the native side while onReadInterval is active.
no setteroverride
-
soilDataStream
→ Stream<
Map< String, double> > -
Soil-sensor samples pushed by the native side while
onReadSoilDataInterval is active.
no setteroverride
Methods
-
connect(
UsbDevice device, {int baudRate = 9600}) → Future< bool> -
Opens a serial connection to
deviceatbaudRate.override -
disconnect(
) → Future< void> -
Closes the current serial connection.
override
-
getConnectedDevice(
) → Future< UsbDevice?> -
Returns the currently connected device, or null if none.
override
-
getDeviceList(
) → Future< List< UsbDevice> > -
Returns the list of USB devices currently attached to the host.
override
-
hasPermission(
UsbDevice device) → Future< bool> -
Whether the app already has permission to access
device.override -
isConnected(
) → Future< bool> -
Whether a device is currently connected.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offReadInterval(
) → Future< void> -
Stops the raw-read interval started by onReadInterval.
override
-
offReadSoilDataInterval(
) → Future< void> -
Stops the soil-read interval started by onReadSoilDataInterval.
override
-
onReadInterval(
{RawReadConfig config = const RawReadConfig(), int intervalMs = 1000}) → Future< void> -
Starts emitting raw serial reads on serialDataStream every
intervalMs, usingconfigfor each individual read.override -
onReadSoilDataInterval(
{SoilSensorConfig config = const SoilSensorConfig(), int intervalMs = 1000}) → Future< void> -
Starts emitting soil-sensor samples on soilDataStream every
intervalMs, usingconfigfor each individual read.override -
read(
{RawReadConfig config = const RawReadConfig()}) → Future< String> -
Reads raw bytes according to
config.override -
readSoilData(
{SoilSensorConfig config = const SoilSensorConfig()}) → Future< Map< String, double> ?> -
Reads one Modbus soil-sensor sample according to
config.override -
requestUsbPermission(
UsbDevice device) → Future< bool> -
Shows the Android USB-permission dialog for
deviceand resolves once the user answers it (or immediately if permission was already granted).override -
toString(
) → String -
A string representation of this object.
inherited
-
write(
String data) → Future< void> -
Writes
datato the currently connected device.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited