rongta_printer

Flutter Version License Platform

A Flutter plugin for printing using Rongta thermal printers. 🖨️

Features

  • Print anything 🤯: Print any widget shape, bypassing the limitations of the Rongta native SDK.
  • Be aware of the printer status 💡: Receive updates about printer connection and document transmission.

Installation

Add the following dependency to your pubspec.yaml file:

dependencies:
  plugin_name: ^0.0.1

Usage

Import the package into your Dart file:

import 'package:rongta_printer/rongta_printer.dart';

Example

Initialize the connection with the printer:

...
final _rongtaPrinterPlugin = RongtaPrinter();

void onConnectionStatusChanged(PrinterConnectionStatus status) {...}
void onOperationStatusChanged(PrinterOperationStatus status) {...}
...
await _rongtaPrinterPlugin.init(
  macAddress: 'DC:0D:30:95:39:A2',
  onPrinterConnectionChange: onConnectionStatusChanged,
  onDocPrinted: onOperationStatusChanged,
);
...

Print your document:

...
_rongtaPrinterPlugin.print(
  doc: Column(
    children: const [
      FlutterLogo(),
      Text('Rongta printing example'),
    ],
  ),
);
...

Known Issues ❗️

  • Using Image.memory will not display anything, as the code loads images instantly, while loading from memory takes time.
  • iOS is not supported yet. 🚧

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a pull request.

Acknowledgments

The code is built on top of the Rongta SDKs for Android and iOS, which can be found here. 🙌