FlutterZebraIntegration class

High-level API for communicating with a Zebra ZPL label printer over WiFi.

Instantiate once and keep alive for the lifetime of the feature that needs printer access. Call dispose when finished to release the connection status stream.

class _MyWidgetState extends State<MyWidget> {
  final _zebra = FlutterZebraIntegration();

  @override
  void dispose() {
    _zebra.dispose();
    super.dispose();
  }
}

Constructors

FlutterZebraIntegration({ZebraPrinterRepository? repository, PDFService? pdfService, ImageService? imageService})
Creates a FlutterZebraIntegration instance and starts monitoring the printer connection status stream.

Properties

hashCode int
The hash code for this object.
no setterinherited
isPrinterConnected bool
true if the printer is currently connected.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

connectToPrinter(String ipAddress, String port) Future<bool?>
Opens a WiFi socket to the printer at ipAddress:port.
disconnectPrinter() Future<bool?>
Closes the active printer connection.
dispose() → void
Releases the connection status stream subscription.
getPlatformVersion() Future<String?>
Returns the host Android SDK version string.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printBarcode(String barcodeData, {String x = '10', String y = '10', int type = 4, String orientation = 'N', String height = '100', String f = 'Y'}) Future<String?>
Prints barcodeData as a barcode label.
printImage(String assetPath, {String x = '10', String y = '10'}) Future<String?>
Prints an image loaded from a Flutter asset.
printPDF(String assetPath, {String x = '10', String y = '10'}) Future<String?>
Prints the first page of a PDF loaded from a Flutter asset.
printText(String textData, {String x = '0', String y = '0', int type = 0, String orientation = 'N', int size = 3}) Future<String?>
Prints textData as a text label.
sendZPLCommand(String zplCommand) Future<String?>
Sends a raw ZPL command string directly to the printer.
toString() String
A string representation of this object.
inherited

Operators

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