printCenteredBarcode static method
Future<bool>
printCenteredBarcode({
- required String data,
- required BarcodeType type,
- int height = 200,
- int width = 6,
- BarcodeTextPosition textPosition = BarcodeTextPosition.below,
- int? printerWidth,
Print a centered barcode with default settings.
Convenience method for printing a barcode with center alignment.
data: Content to encode in the barcodetype: Barcode type (CODE128, QR, etc.)height: Barcode height in dotswidth: Barcode module width in dotstextPosition: Position of human-readable textprinterWidth: Printer width in dots
Returns true if printing was successful.
Implementation
static Future<bool> printCenteredBarcode({
required String data,
required BarcodeType type,
int height = 200,
int width = 6,
BarcodeTextPosition textPosition = BarcodeTextPosition.below,
int? printerWidth,
}) async {
// Always center for this function
const alignment = Alignment.center;
// Use the existing barcode print function with center alignment
return await printBarcode(
data,
type,
height: height,
width: width,
alignment: alignment,
textPosition: textPosition,
);
}