Printer class

Optimized printer model with better data validation and serialization

Inheritance
Available extensions

Constructors

Printer.new({String? address, String? name, ConnectionType? connectionType, bool? isConnected, String? vendorId, String? productId})
Printer.fromJson(Map<String, dynamic> json)
Create Printer from JSON with validation
factory

Properties

address String?
final
connectionState Future<BleConnectionState>
Returns connection state of the device. All platforms will return Connected/Disconnected states. Android and Apple can also return Connecting/Disconnecting states.
no setterinherited
connectionStream Stream<bool>

Available on BleDevice, provided by the BleDeviceExtension extension

A stream of bool that emits connection status changes for the device.
no setter
connectionType ConnectionType?
final
connectionTypeString String
Get human-readable connection type string
no setter
deviceId String
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
hasValidConnectionData bool
Check if printer has valid connection data
no setter
isConnected bool?
final
isConnected Future<bool>

Available on BleDevice, provided by the BleDeviceExtension extension

Checks if the device is currently connected.
no setter
isSystemDevice bool?
getter/setter pairinherited
manufacturerData Uint8List?
no setterinherited
manufacturerDataList List<ManufacturerData>
getter/setter pairinherited
name String?
finalgetter/setter pairinherited-setteroverride-getter
paired bool?
getter/setter pairinherited
pairingStateStream Stream<bool>

Available on BleDevice, provided by the BleDeviceExtension extension

A stream of bool that emits pairing status changes for the device.
no setter
productId String?
final
rawName String?
getter/setter pairinherited
receivesAdvertisements bool
On web, it returns true if the web browser supports receiving advertisements from this device. The rest of the platforms will always return true.
no setterinherited
rssi int?
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
services List<String>
List of services advertised by the device.
getter/setter pairinherited
uniqueId String
Generate unique identifier for the printer
no setter
vendorId String?
final

Methods

connect() Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Connects to the device.
copyWith({String? address, String? name, ConnectionType? connectionType, bool? isConnected, String? vendorId, String? productId}) Printer
Create a copy with updated fields
disconnect() Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Disconnects from the device.
discoverServices({Duration? timeout}) Future<List<BleService>>

Available on BleDevice, provided by the BleDeviceExtension extension

Discovers the services offered by the device.
getCharacteristic(String characteristic, {required String service, bool preferCached = true, Duration? timeout}) Future<BleCharacteristic>

Available on BleDevice, provided by the BleDeviceExtension extension

Retrieves a specific characteristic from a service.
getService(String service, {bool preferCached = true, Duration? timeout}) Future<BleService>

Available on BleDevice, provided by the BleDeviceExtension extension

Retrieves a specific service.
isPaired({BleCommand? pairingCommand, Duration? timeout}) Future<bool?>

Available on BleDevice, provided by the BleDeviceExtension extension

Check if a device is paired.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pair({BleCommand? pairingCommand, Duration? timeout}) Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Pair a device.
requestMtu(int expectedMtu) Future<int>

Available on BleDevice, provided by the BleDeviceExtension extension

Requests a specific MTU (Maximum Transmission Unit) size for the connection.
toJson() Map<String, dynamic>
Convert to JSON with proper formatting
toString() String
A string representation of this object.
override
unpair({Duration? timeout}) Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Unpair a device.

Operators

operator ==(Object other) bool
The equality operator.
inherited