flutter_zpl_generator library

Generate ZPL (Zebra Programming Language) label code in Flutter and Dart.

Build a label from ZplCommands (text, barcodes, shapes, images, fonts, grid and table layouts), wrap them in a ZplGenerator, and call ZplGenerator.build to get the ZPL string. Preview it offline with ZplNativePreview or through Labelary with ZplPreview.

To send the ZPL to a Zebra printer, use the flutter_zpl_printer package.

Classes

Gs1ApplicationIdentifier
One GS1 application identifier: its code, name and value rule.
Gs1Element
One application identifier with its value.
Gs1ElementString
Parsing, formatting and FNC1 conversion for GS1 element strings.
LabelaryPageLayout
Class to represent page layout configuration for PDF generation.
LabelaryResponse
Class to represent the response from Labelary API with additional metadata.
LabelaryService
A service class to interact with the Labelary.com API.
LabelaryWarning
Class to represent a parsed linting warning from the Labelary API.
ZplAdvancedTextProperties
Configures advanced text properties like RTL (Right-to-Left) printing, bidirectional text, and OpenType ligatures natively in ZPL.
ZplAssetService
A thin helper for loading binary assets (currently: TrueType fonts) from Flutter's asset bundle.
ZplBarcode
A barcode field. Symbology-specific ZPL lives in zpl_barcode_symbology_emitter.dart; width estimates in zpl_barcode_width_estimator.dart.
ZplBox
A class to handle the Graphic Box command (^GB).
ZplColumn
A layout helper to arrange multiple ZplCommand objects vertically in a column. Children are positioned automatically based on their calculated heights.
ZplCommand
The base class for all ZPL commands.
ZplConditional
A wrapper command that conditionally includes or excludes its child command. If condition is false, this command outputs nothing and takes up zero space in layout containers like ZplColumn or ZplGridRow.
ZplConfiguration
Represents global ZPL configuration settings for a label. Passed as context to all commands via toZpl(context).
ZplControlCommand
Marker abstract subclass for ZPL control commands — those that start with a tilde (~DG, ~DY, ~JA, …) and are processed immediately by the printer's communication processor.
ZplEarlyWarning
Configures the Early Warning hardware diagnostics subsystem (^JH).
ZplFieldDataEscaper
Escapes for text field data written after ^FD or ^SN.
ZplFontUpload
A ZPL control command that uploads a TrueType font to the printer's volatile memory (E: drive) via ~DY.
ZplGenerator
Aggregates a list of ZplCommand instances and generates the final ZPL script string.
ZplGraphicCircle
A command to draw a graphic circle using the ZPL ^GC command.
ZplGraphicDiagonalLine
A command to draw a graphic diagonal line using the ZPL ^GD command.
ZplGraphicEllipse
A command to draw a graphic ellipse using the ZPL ^GE command.
ZplGraphicSymbol
A class to handle the Graphic Symbol command (^GS).
ZplGridCol
Represents a column in a 12-unit grid system.
ZplGridRow
Creates a row with a 12-unit grid system for structured layouts.
ZplHostQuery
Triggers a Host Query (~HQ) response back over the printer port (e.g. Serial or TCP) returning hardware diagnostic states.
ZplImageDownload
A ZPL control command that downloads a monochrome graphic to the printer's volatile memory via ~DG. Pair with ZplImageRecall to position and print it.
ZplImageInline
A ZPL format command that emits a one-shot compressed graphic inline via ^GFA. No ~DG separate-download step — the bitmap travels inside the active format. Best when you print the image once and never reuse.
ZplImageRecall
A ZPL format command that recalls a previously-downloaded graphic at position (x, y). Pair with a ZplImageDownload whose graphicName matches this command's.
ZplNativePreview
A widget that renders ZPL commands locally using Flutter's CustomPainter. This allows 100% offline previewing without relying on the Labelary API.
ZplNetworkBoot
Network Boot Print Server Check (^NB) Sets the interval for the print server to check for a boot block.
ZplNetworkConnect
Network Connect (~NC) Connects to a secondary network.
ZplNetworkDevice
Primary Network Device (^NC) Sets the primary network device.
ZplNetworkId
Network ID Number (^NI) Assigns a Network ID number.
ZplNetworkPasswordTimeout
Set Password Timeout (^NW) Sets the duration before a password expires physically.
ZplNetworkPrimaryDevice
Set Primary Device (^NP) Defines the primary connection device.
ZplNetworkPrintersTransparentAll
Set All Network Printers Transparent (~NR)
ZplNetworkPrinterTransparentCurrent
Set Current Printer Transparent (~NT)
ZplNetworkSettings
Modify Network Settings (^ND) Changes network parameters for a specific device.
ZplNetworkSmtp
Configure SMTP (^NT) Sets the email server routing parameters.
ZplNetworkSnmp
Configure SNMP (^NN) Sets the parameters for SNMP.
ZplNetworkWiredSettings
Modify Wired Network Settings (^NS) Configures network settings.
ZplPreview
A widget that takes a ZplGenerator instance, renders it using the Labelary API, and displays the resulting label image.
ZplPrintQuantity
Represents the ^PQ (Print Quantity) command.
ZplRaster
The result of ZplRasterizer.render: a PNG of the label at scale pixels per dot, plus how much of it is ink.
ZplRasterizer
Renders a ZplGenerator to a PNG offscreen, with the same painter that backs ZplNativePreview, so no network and no widget tree are needed.
ZplRaw
A command that outputs raw ZPL string directly without any processing.
ZplRfidSetup
Represents the ^RS (RFID Setup) command.
ZplRfidWrite
Represents the ^RF (RFID Read/Write Format) sequence.
ZplSeparator
A widget that creates separator lines using either box drawing or repeated characters.
ZplSerialConfig
Configuration for ZPL Serialization (^SN command).
ZplTable
A highly configurable widget that generates a table with headers, data rows, and borders using ZPL commands.
ZplTableHeader
A helper class to define the content and styling of a table header.
ZplTemplate
A template engine that enables data binding onto pre-compiled raw ZPL strings.
ZplText
A class to handle text-related commands (^FO, ^A, ^FD, ^FS).
ZplTextBlock
A block text field designed specifically for rendering paragraphs and complex bidirectional text (like Arabic/Hebrew) using ^TB.
ZplTextFit
How much room a ZplText needs against the ^FB block it sits in, as the preview painter measures it. See measureZplText.
ZplZbiStart
Starts an immediate Zebra Basic Interpreter (ZBI) script run directly on the printer hardware OS.
ZplZbiStop
Aborts execution of any running Zebra Basic Interpreter (ZBI) script immediately via the ~JQ host command.

Enums

Gs1CharKind
The character kind an application identifier (AI) value may hold.
Gs1ValueError
Why a value breaks the rule of its application identifier.
LabelaryLabelBorder
PDF label border styles supported by the Labelary API.
LabelaryOutputFormat
Enum for output formats supported by the Labelary API.
LabelaryPageAlign
PDF page alignment supported by the Labelary API.
LabelaryPageOrientation
PDF page orientation supported by the Labelary API.
LabelaryPageSize
PDF page sizes supported by the Labelary API.
LabelaryPrintDensity
Enum for print density options supported by the Labelary API.
LabelaryPrintQuality
PNG image quality supported by the Labelary API.
LabelaryRotation
Label rotation degrees supported by the Labelary API.
RfidDataFormat
RFID Data Formats for the ^RF command.
RfidMemoryBank
RFID Memory Banks for Gen 2 tags via the ^RF command.
RfidOperation
RFID Operation types for the ^RF command.
ZplAlignment
Enum for horizontal alignment of elements within a layout container.
ZplBarcodeType
Enum for different barcode types.
ZplCode128Mode
Code 128 input mode (^BC parameter m).
ZplDitheringAlgorithm
Image-to-monochrome conversion strategy.
ZplFont
Enum for ZPL fonts. Corresponds to the ^A command. zero is the scalable font.
ZplGraphicSymbolType
Supported types of graphic symbols for the ^GS command.
ZplImageCompression
Hex-body encoding strategy for ~DG downloads and ^GFA inline graphics.
ZplMediaType
Enum for media types. Corresponds to the ^MT command.
ZplOrientation
Enum for field orientation.
ZplPrintDensity
Enum for print density (resolution). Corresponds to the ^JM command.
ZplPrintMode
Enum for different print modes. Corresponds to the ^MM command.
ZplPrintOrientation
Enum for print orientation. Corresponds to the ^PO command.
ZplQrErrorCorrection
QR Code error-correction level (^BQ and the ^FD prefix).
ZplSeparatorType
Enum for different types of separators
ZplStorage
Enum for printer storage locations.

Constants

kGs1DataMatrixEscape → const String
The escape character for GS1 Data Matrix (^BXo,h,200,,,,@): FNC1 is @1 and the group separator @d029.

Functions

gs1AppendCheckDigit(String body) → String
Appends the GS1 check digit to a 13 digit GTIN body.
gs1CheckDigit(String body) → int
Computes the GS1 mod-10 check digit for body, the digits that come before the check digit (13 digits for a GTIN-14).
gs1IsPlaceholder(String value) → bool
True when value is one whole {{placeholder}}.
gs1PadGtinTo14(String gtin) → String
Left-pads an 8, 12 or 13 digit GTIN (or any digit string up to 14) with zeros to 14 digits. A longer value is returned unchanged.
measureZplText(ZplText text, ZplConfiguration config) → ZplTextFit
Measures text with the same font, scale and wrap width as drawZplText, but with no line limit, so a text that needs more lines than ^FB allows can be told apart. A text with a maxWidth is measured against that block even when it is one left-aligned line, which the painter draws unwrapped. Needs the Flutter bindings, like ZplRasterizer.render.