MethodChannelFlutterSimpleBluetoothPrinter class
By Xiao 2023/1 An implementation of FlutterSimpleBluetoothPrinterPlatform that uses method channels.
- Inheritance
-
- Object
- PlatformInterface
- FlutterSimpleBluetoothPrinterPlatform
- MethodChannelFlutterSimpleBluetoothPrinter
Constructors
Properties
-
connectState
→ Stream<
BTConnectState> -
no setteroverride
- eventChannel → EventChannel
-
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
-
scanResults
→ Stream<
List< BluetoothDevice> > -
no setteroverride
Methods
-
connect(
{required String address, bool isBLE = true, Duration timeout = const Duration(seconds: 7)}) → Future< bool> -
Connect to a Bluetooth device via address.
isBLE
Whether this is a BLE device. In iOS, this is ignored cause we only support BLE for iOS.timeout
The timeout for BLE connection. For non-BLE connection, this is ignored. Throw BTException if failed.override -
currentConnectState(
) → Future< BTConnectState> -
Get the current Connect State.
override
-
disconnect(
) → Future< bool> -
Disconnect from a Bluetooth device.
Throw BTException if failed.
override
-
discovery(
) → Stream< BluetoothDevice> -
Starts scan for Bluetooth LE devices
Note: This is a continuous behavior, don't forget to call stopDiscovery.
Throw BTException if failed.
override
-
getAndroidPairedDevices(
) → Future< List< BluetoothDevice> > -
Get paired devices for Android.
For iOS, it will return an empty list.
Throw BTException if failed.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scan(
{required Duration timeout}) → Future< List< BluetoothDevice> > -
Scan for Bluetooth LE devices until
timeout
is reached. Throw BTException if failed.override -
stopDiscovery(
) → Future< bool> -
Stops scan for Bluetooth LE devices.
Throw BTException if failed.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
writeRawData(
Uint8List bytes) → Future< bool> -
Write raw data to the connected device. Must connect to a device first.
Throw BTException if failed.
override
-
writeText(
String text) → Future< bool> -
Write text to the connected device. Must connect to a device first.
Throw BTException if failed.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited