PrinterGateway class

Main gateway class for converting JSON receipt data into various formats.

This class provides methods to convert structured JSON receipt data into:

  • Flutter widgets for display
  • Images (PNG format)
  • POS printer compatible format (List of Uint8List)
  • ESC/POS printer compatible format (List of decoded Images)

The primary goal is to ensure consistent receipt rendering across different devices by generating a unified image representation.

Constructors

PrinterGateway({String jsonData = '[{}]', Uint8List? imageHeader, Uint8List? imageFooter})
Creates a PrinterGateway instance.

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

addData(String jsonData) String
Updates the receipt JSON data.
addFooterImage(Uint8List image) Uint8List
Adds or updates the footer image for the receipt.
addHeaderImage(Uint8List image) Uint8List
Adds or updates the header image for the receipt.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toEscPosPrinter(BuildContext context, {int maxHeight = 2000, double maxWidth = 576, int margin = 0, double fixedRatio = 0}) Future<List<Image>>
Converts the receipt into a list of decoded Images for ESC/POS printers.
toImage(BuildContext context, {double maxWidth = 576, int margin = 0, double fixedRatio = 0}) Future<Uint8List>
Generates a single image (PNG) from the receipt data.
toPosPrinter(BuildContext context, {int maxHeight = 2000, double maxWidth = 576, int margin = 0, double fixedRatio = 0}) Future<List<Uint8List>>
Converts the receipt into a list of image bytes for POS printers.
toString() String
A string representation of this object.
inherited
toWidget({double maxWidth = 576, int margin = 0}) Widget
Converts the JSON receipt data into a Flutter Widget.

Operators

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