Büşra KORKMAZ
Büşra KORKMAZ

Reputation: 11

Flutter TSC Thermal Printer

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

Answers (1)

ankushlokhande
ankushlokhande

Reputation: 1912

Find the compatible SDK from pub.dev
& here is the list of some flutter SDK's that I used previously:

Follow steps to integrate the SDK:

  1. First, you need to add the plugin for the Bluetooth thermal printer to your existing Flutter project. You can do this by adding the following dependency to your pubspec.yaml file.
dependencies: 
  flutter_bluetooth_thermal_printer: ^1.0.0
  1. Import the plugin in your project:
import 'package:[PACKAGE_NAME].dart';
  1. 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:

  2. 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();
}
  1. Scan the device & connect to the printer:

eg.

// Connect to the printer 
FlutterBluetoothThermalPrinter.connect('MY_PRINTER_ID').then((printer) { 
  // Print text 
  printer.printString('Hello World!'); 
});
  1. Now use the print method to print the data on any screen.

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

Related Questions