0 purchases
printer plus
printer_plus #
A Flutter plugin for print text, qrcode, barcode label to printer via bluetooth.
Using #
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile and web development, and a full API reference.
Installation #
First, add printer_plus as a dependency in your pubspec.yaml file.
In your flutter project add the dependency:
dependencies:
...
printer_plus:
copied to clipboard
For help getting started with Flutter, view the online
documentation.
Platform Support #
Android
iOS
MacOS
Web
Linux
Windows
✔️
️X
️X
️X
️X
️X
Setup #
Change the minSdkVersion for Android #
Flutter_blue is compatible only from version 19 of Android SDK so you should change this in android/app/build.gradle:
Android {
defaultConfig {
minSdkVersion: 19
copied to clipboard
Add permissions for Bluetooth #
We need to add the permission to use Bluetooth and access location:
Android
In the android/app/src/main/AndroidManifest.xml let’s add:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
copied to clipboard
IOS
In the ios/Runner/Info.plist let’s add:
<dict>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Need BLE permission</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Need BLE permission</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Need Location permission</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Need Location permission</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Need Location permission</string>
copied to clipboard
For location permissions on iOS see more at: https://developer.apple.com/documentation/corelocation/requesting_authorization_for_location_services
Example #
Please follow this example here.
Print (TSC Bluetooth Printer) #
TSCBTPrinter.printText(macAddress: "MAC Address", content: "datadirr");
TSCBTPrinter.printQR(macAddress: "MAC Address", content: "datadirr");
TSCBTPrinter.printBarcode(macAddress: "MAC Address", content: "datadirr");
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.