cs10_z100_pos_printer 1.1.0
cs10_z100_pos_printer: ^1.1.0 copied to clipboard
A Flutter plugin for printing on CS10-Z100 POS terminals.
CS10-Z100 POS Printer Plugin #
A Flutter plugin for printing on the integrated terminal of CS10-Z100 POS devices. Built specifically for Android POS models CS10 and Z100
Features #
- Initialize and close the printer connection.
- Check the printer status.
- Print text with customizable alignment and font settings.
- Print QR code.
Important: Be sure to call printInit()
at least once before using any other methods.
Device Compatibility #
Important: This plugin is exclusively compatible with the CS10-Z100 POS terminal. It will not function correctly and will print Plugin does not support this device, use a CS10 or Z100 printer model
message on the console.
- Model: Must contain "CS10" or "Z100" (case-insensitive, e.g., CS10Z100, CS10Android).
- Android OS Version: Must be between Android 5.1 (API 22) and Android 7.1.1 (API 25) inclusive.
These models usually look like this:
Installation #
Add the plugin to your Flutter project by running:
flutter pub add cs10_z100_pos_printer
Usage #
Import the plugin:
import 'package:cs10_z100_pos_printer/cs10_z100_pos_printer.dart';
Initialize the printer plugin instance:
import 'package:cs10_z100_pos_printer/cs10_z100_pos_printer.dart';
void main() async {
final printer = Cs10Z100PosPrinter();
final wasInit = await printer.printInit();
if (wasInit) {
print('Printer initialized successfully');
} else {
print('Printer initialization failed');
}
}
Add text to the printer queue:
import 'package:cs10_z100_pos_printer/cs10_z100_pos_printer.dart';
void main() async {
final printer = Cs10Z100PosPrinter();
final wasInit = await printer.printInit();
if (!wasInit) return;
// option 1
await printer.addString(PrinterText('Example Text',align: PrinterStringAlign.center,zoom: PrinterStringZoom.medium));
// option 2
await printer.addToQueue(PrinterText('Example Text',align: PrinterStringAlign.center,zoom: PrinterStringZoom.medium));
}
Add a Qr Code to the queue:
import 'package:cs10_z100_pos_printer/cs10_z100_pos_printer.dart';
void main() async {
final printer = Cs10Z100PosPrinter();
final wasInit = await printer.printInit();
if (!wasInit) return;
// option 1
await printer.addQrCode(PrinterQrCode('https://pub.dev/packages/cs10_z100_pos_printer', align: PrinterStringAlign.center));
// option 2
await printer.addToQueue(PrinterQrCode('https://pub.dev/packages/cs10_z100_pos_printer', align: PrinterStringAlign.center));
}
Start printing the queue:
final printStarted = await printer.printStart();
Clears the queue:
await printer.printClose();
Example:
import 'package:cs10_z100_pos_printer/cs10_z100_pos_printer.dart';
void main() async {
final space = List.generate(8, (index) => '\n').join();
final printer = Cs10Z100PosPrinter();
final wasInit = await printer.printInit();
if (!wasInit) return;
final List<Printable> list = [
PrinterText(
'Example Title',
align: PrinterStringAlign.center,
zoom: PrinterStringZoom.medium,
),
PrinterText('\n\n'),
PrinterText('Receipt Number:\t12034'),
PrinterText('Date:\t25/04/2025'),
PrinterText('\n'),
PrinterText('Amount: \$. 10.00'),
PrinterText('Tax: \$. 1.00'),
PrinterText('Total: \$. 11.00'),
PrinterText('\n'),
PrinterQrCode('https://pub.dev/packages/cs10_z100_pos_printer', align: PrinterStringAlign.center),
PrinterText('Url Link', align: PrinterStringAlign.center, size: PrinterStringSize.small),
PrinterText(space, align: PrinterStringAlign.center),
];
bool stringAdded = false;
for (var element in list) {
stringAdded = await printer.addToQueue(element);
if (!stringAdded) return;
}
final printStarted = await printer.printStart();
if (!printStarted) return;
await printer.printClose();
}