pos_printer_helper 1.1.3 copy "pos_printer_helper: ^1.1.3" to clipboard
pos_printer_helper: ^1.1.3 copied to clipboard

PlatformAndroid

A Flutter package that provides a unified interface for thermal printer operations across multiple POS device manufacturers.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:pos_printer_helper/pos_printer_helper.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Future<PrinterStatus>? _printerStatus;

  @override
  void initState() {
    super.initState();
    _updatePrinterStatus();
  }

  void _updatePrinterStatus() {
    setState(() {
      _printerStatus = PosPrinterPlugin.getPrinterStatus();
    });
  }

  @override
  Widget build(BuildContext context) {
    final status = PosPrinterPlugin.getPrinterStatus();

    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('Printer example'),
            ),
            body: Center(
              child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    FutureBuilder<PrinterStatus>(
                      future: _printerStatus,
                      builder: (context, snapshot) {
                        if (snapshot.connectionState ==
                            ConnectionState.waiting) {
                          return const CircularProgressIndicator();
                        }
                        return Text('${snapshot.data}');
                      },
                    ),
                    Text("$status"),
                    FilledButton(
                        onPressed: () {
                          PosPrinterPlugin.printText(
                              "Hello World\nHello World\nHello World\n\n\n\n\n\n",
                              30,
                              true,
                              true);
                          PosPrinterPlugin.cutPaper();
                          PosPrinterPlugin.start();
                          _updatePrinterStatus();
                        },
                        child: Text("Click me"))
                  ]),
            )));
  }
}
copied to clipboard
12
likes
150
points
72
downloads

Publisher

verified publishercashier-iq.com

Weekly Downloads

2024.09.09 - 2025.03.24

A Flutter package that provides a unified interface for thermal printer operations across multiple POS device manufacturers.

Repository (GitHub)
View/report issues

Topics

#printing #thermal

Documentation

API reference

License

MIT (license)

Dependencies

flutter, pigeon, plugin_platform_interface

More

Packages that depend on pos_printer_helper