SunmiBarcodeStyle class

Represents the configuration for printing barcodes using a Sunmi printer.

The SunmiBarcodeStyle class provides a flexible and structured way to define the appearance and properties of a barcode. This includes settings for size, height, text position, barcode type, and alignment.

It ensures that all properties conform to valid ranges, avoiding invalid configurations and providing meaningful error messages if an invalid value is supplied.

Example Usage

SunmiBarcodeStyle style = SunmiBarcodeStyle(
  size: 4,
  height: 100,
  textPos: SunmiBarcodeTextPos.TEXT_BELOW,
  type: SunmiBarcodeType.CODE39,
  align: SunmiPrintAlign.LEFT,
);

This configuration can then be passed to a printer function to print a barcode.

Constructors

SunmiBarcodeStyle({int size = 4, int height = 162, SunmiBarcodeTextPos textPos = SunmiBarcodeTextPos.NO_TEXT, SunmiBarcodeType type = SunmiBarcodeType.CODE128, SunmiPrintAlign align = SunmiPrintAlign.CENTER})
Factory constructor to create a SunmiBarcodeStyle object with default values and optional customizations.
factory

Properties

align SunmiPrintAlign
The alignment of the barcode on the page or print area.
final
hashCode int
The hash code for this object.
no setterinherited
height int
The height of the barcode.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
The size of the barcode.
final
textPos SunmiBarcodeTextPos
The position of the text relative to the barcode.
final
type SunmiBarcodeType
The type of the barcode.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
Converts the SunmiBarcodeStyle object to a map for easy transfer or serialization.
toString() String
A string representation of this object.
inherited

Operators

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