Reputation: 11
I am developing a Flutter app, and I’ve been trying to print via bluetooth in a thermal printer. I have found a lot of libraries/package for bluetooth thermal printers, but I need my program to print with TSC Alpha-3RB. But the printer does not appear on the device. I don't know if I need to do anything else about it.
Does someone know some package or method I can try to achieve my goal?
Thanks in advance for any help.
Upvotes: 1
Views: 1475
Reputation: 1912
Find the compatible SDK from pub.dev
& here is the list of some flutter SDK's that I used previously:
dependencies:
flutter_bluetooth_thermal_printer: ^1.0.0
import 'package:[PACKAGE_NAME].dart';
Create a saperate window (UI) to search available printers & after that, you can use the plugin to connect to and print from the Bluetooth thermal printer. For example, you can use the following steps to connect to the printer and print a simple text:
First check the bluetooth is On
or Off
. You can check bluetooth device using system_shortcuts package.
// it return true if already bluetooth is turned on var isOn = SystemShortcuts.checkBluetooth; if (!isOn){ // it turn-on the bluetooth await SystemShortcuts.bluetooth(); }
eg.
// Connect to the printer FlutterBluetoothThermalPrinter.connect('MY_PRINTER_ID').then((printer) { // Print text printer.printString('Hello World!'); });
Note that this is just a general outline of the process for integrating a Bluetooth thermal printer into a Flutter project. You will need to consult the documentation for the Flutter Bluetooth package and the specific documentation for your printer in order to complete the integration or run the sample code.
Upvotes: 0