andrey-ushakov / esc_pos_bluetooth Goto Github PK
View Code? Open in Web Editor NEWESC/POS (thermal, receipt) printing for Flutter & Dart (Android/iOS)
License: BSD 3-Clause "New" or "Revised" License
ESC/POS (thermal, receipt) printing for Flutter & Dart (Android/iOS)
License: BSD 3-Clause "New" or "Revised" License
Hi,
Great package but I miss a few things like being able to access advertisement data of the bluetooth devices to filter out printers only?
Would it be an idea to re-base this on https://pub.dev/packages/flutter_blue which seems to be a bit more mature than flutter_bluetooth_basic?
The functionality is pretty much the same.
I'm running the example project "Blue" and I'm getting this error:
/BluetoothBasicPlugin(31020): start scan
D/BluetoothAdapter(31020): isLeEnabled(): ON
D/BluetoothLeScanner(31020): onScannerRegistered() - status=0 scannerId=9 mScannerId=0
D/BluetoothAdapter(31020): isLeEnabled(): ON
D/BluetoothBasicPlugin(31020): start scan
D/BluetoothAdapter(31020): isLeEnabled(): ON
D/BluetoothLeScanner(31020): onScannerRegistered() - status=0 scannerId=9 mScannerId=0
D/BluetoothAdapter(31020): isLeEnabled(): ON
D/BluetoothAdapter(31020): isLeEnabled(): ON
D/BluetoothLeScanner(31020): could not find callback wrapper
W/BluetoothAdapter(31020): getBluetoothService() called with no BluetoothManagerCallback
D/BluetoothBasicPlugin(31020): stateStreamHandler, current action: android.bluetooth.device.action.ACL_CONNECTED
E/DeviceConnFactoryManager(31020): wait read
E/flutter (31020): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: Future already completed
E/flutter (31020): #0 _AsyncCompleter.complete (dart:async/future_impl.dart:41:31)
E/flutter (31020): andrey-ushakov/esc_pos_printer#1 PrinterBluetoothManager.writeBytes.<anonymous closure> (package:esc_pos_printer/src/printer_bluetooth_manager.dart:121:19)
E/flutter (31020): andrey-ushakov/esc_pos_printer#2 _rootRunUnary (dart:async/zone.dart:1134:38)
E/flutter (31020): andrey-ushakov/esc_pos_printer#3 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (31020): andrey-ushakov/esc_pos_printer#4 _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
E/flutter (31020): andrey-ushakov/esc_pos_printer#5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
E/flutter (31020): andrey-ushakov/esc_pos_printer#6 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
E/flutter (31020): andrey-ushakov/esc_pos_printer#7 Future._complete (dart:async/future_impl.dart:516:7)
E/flutter (31020): andrey-ushakov/esc_pos_printer#8 new Future.delayed.<anonymous closure> (dart:async/future.dart:313:16)
E/flutter (31020): andrey-ushakov/esc_pos_printer#9 _rootRun (dart:async/zone.dart:1122:38)
E/flutter (31020): andrey-ushakov/esc_pos_printer#10 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (31020): andrey-ushakov/esc_pos_printer#11 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter (31020): andrey-ushakov/esc_pos_printer#12 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
E/flutter (31020): andrey-ushakov/esc_pos_printer#13 _rootRun (dart:async/zone.dart:1126:13)
E/flutter (31020): andrey-ushakov/esc_pos_printer#14 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (31020): andrey-ushakov/esc_pos_printer#15 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
E/flutter (31020): andrey-ushakov/esc_pos_printer#16 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15)
E/flutter (31020): andrey-ushakov/esc_pos_printer#17 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (31020): andrey-ushakov/esc_pos_printer#18 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (31020): andrey-ushakov/esc_pos_printer#19 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter (31020):
D/BluetoothSocket(31020): close() this: android.bluetooth.BluetoothSocket@a214a42, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@5d8ea53, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@3f33f90mSocket: android.net.LocalSocket@5502089 impl:android.net.LocalSocketImpl@ffdc88e fd:java.io.FileDescriptor@dfdd8af, mSocketState: CONNECTED
D/BluetoothSocket(31020): close() this: android.bluetooth.BluetoothSocket@a214a42, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@5d8ea53, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@3f33f90mSocket: null, mSocketState: CLOSED
W/System.err(31020): java.io.IOException: bt socket closed, read return: -1
D/BluetoothSocket(31020): close() this: android.bluetooth.BluetoothSocket@a214a42, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@5d8ea53, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@3f33f90mSocket: null, mSocketState: CLOSED
W/System.err(31020): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:564)
W/System.err(31020): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:88)
W/System.err(31020): at java.io.InputStream.read(InputStream.java:101)
W/System.err(31020): at com.gprinter.io.BluetoothPort.readData(BluetoothPort.java:130)
W/System.err(31020): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.readDataImmediately(DeviceConnFactoryManager.java:418)
W/System.err(31020): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.run(DeviceConnFactoryManager.java:498)
E/BluetoothPort(31020): connection device is lost
E/DeviceConnFactoryManager(31020): read 0
D/BluetoothBasicPlugin(31020): stateStreamHandler, current action: android.bluetooth.device.action.ACL_DISCONNECTED
I'm using flutter 1.14.6
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.14.6, on Mac OS X 10.15.3 19D76, locale es-419)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.42.1)
[✓] Connected device (3 available)
• No issues found!
I have tested on iOS with this printer. All functions worked well.
https://www.craftdata.co.uk/thermal-printers/fk-pc301-d-3-mobile-thermal-printer-with-autocutter
But it has some problems need to be improved.
1/ writeData method with big data, this device auto disconnect.
2/ Printing not smooth. Maybe you should support split byte data to more packets.
Printing throws this exception:
Bad state: Future already completed
I/flutter ( 9568): #0 _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
I/flutter ( 9568): #1 PrinterBluetoothManager.writeBytes. (package:esc_pos_bluetooth/src/printer_bluetooth_manager.dart:117:23)
I/flutter ( 9568):
I/flutter ( 9568): #2 PrinterBluetoothManager.writeBytes. (package:esc_pos_bluetooth/src/printer_bluetooth_manager.dart)
I/flutter ( 9568): #3 _rootRunUnary (dart:async/zone.dart:1198:47)
I/flutter ( 9568): #4 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
I/flutter ( 9568): #5 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
I/flutter ( 9568): #6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
I/flutter ( 9568): #7 _DelayedData.perform (dart:async/stream_impl.dart:611:14)
I/flutter ( 9568): #8 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
I/flutter ( 9568): #9 _PendingEvents.schedule. (dart:async/stream_impl.dart:687:7)
I/flutter ( 9568): #10 _rootRun (dart:async/zone.dart:1182:47)
I/flutter ( 9568): #11 _CustomZone.run (dart:async/zone.dart:1093:19)
I/flutter ( 9568): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
Hi,
I've tested testing with Seiko Thermal Printer. Unfortunately, it didn't get listed during the scanning process.
Any idea about this?
Please someone can help me?
The steps I made where: install the needed packages, pub get, create the dart and test. ¿I forgot something?
I don't know what i'm doing wrong :(
This plugin does not find any devices.
Once installed on the demo, I can't find any of my bluetooh terminals, either telephone or inpriment .
my repot is : https://github.com/ndemeyvan/esc_bluetooh_printer.git
Please help
From Apple
2. 5 Performance: Software Requirements
Guideline 2.5.4 - Performance - Software Requirements
Your app declares support for bluetooth-central and bluetooth-peripheral in the UIBackgroundModes key in your Info.plist but does not provide Bluetooth Low Energy functionality. The Bluetooth Background modes are for apps that communicate to other devices using Bluetooth Low Energy and the Core Bluetooth framework.
Next Steps
To resolve this issue, please revise your app to add support for Bluetooth Low Energy communication through Core Bluetooth in your app or remove the bluetooth- values from the UIBackgroundModes key.
Resources
For more information on Core Bluetooth, please review the Core Bluetooth Framework Reference.
Printer shows up in bluetooth devices list but unable to select when using device scanner. Other bluetooth printers can be discovered as well as other bluetooth devices.
Model: https://www.amazon.com/Aibecy-Handheld-Terminal-Intelligent-Communication/dp/B07PP4WN42
Hi Andrey,
I am getting the following error. Please help.
/BluetoothBasicPlugin(10182): start scan
D/BluetoothAdapter(10182): isLeEnabled(): ON
D/BluetoothLeScanner(10182): onScannerRegistered() - status=0 scannerId=7 mScannerId=0
D/BluetoothAdapter(10182): isLeEnabled(): ON
D/BluetoothAdapter(10182): isLeEnabled(): ON
D/BluetoothLeScanner(10182): could not find callback wrapper
W/BluetoothAdapter(10182): getBluetoothService() called with no BluetoothManagerCallback
D/BluetoothBasicPlugin(10182): stateStreamHandler, current action: android.bluetooth.device.action.ACL_CONNECTED
E/DeviceConnFactoryManager(10182): wait read
E/BluetoothPort(10182): read length1
E/DeviceConnFactoryManager(10182): read 1
E/DeviceConnFactoryManager(10182): wait read
W/System.err(10182): java.io.IOException: bt socket closed, read return: -1
W/System.err(10182): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:558)
W/System.err(10182): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:88)
Because every version of esc_pos_bluetooth depends on rxdart ^0.23.1 and driver depends on rxdart ^0.24.0, esc_pos_bluetooth is forbidden.
So, because driver depends on esc_pos_bluetooth ^0.2.8, version solving failed.
pub get failed (1; So, because driver depends on esc_pos_bluetooth ^0.2.8, version solving failed.)
I have a non ble device.
Android works fine. But ios doesnt.
From my understanding non ble devices dont work with CoreBluetooth Api and need to use ExternalAccessory Api.
Is there a chance that you support non ble devices?
Can you support multiple printers for printing, thank you
Because every version of esc_pos_bluetooth depends on rxdart ^0.23.1 and depends on rxdart ^0.24.1, esc_pos_bluetooth is forbidden.
Tested with the example app, for e.g line:
ticket.row([
PosColumn(text: '2', width: 1),
PosColumn(text: 'ONION RINGS', width: 7),
PosColumn(
text: '0.99', width: 2, styles: PosStyles(align: PosAlign.right)),
PosColumn(
text: '1.98', width: 2, styles: PosStyles(align: PosAlign.right)),
]);
It only prints 1.98 aligned to the right.
Hello, I am testing this package with the esc_pos_utils 0.3.6 (since 0.4.5 doesn't seem to work yet). I read in the README that you can print PDF417 barcode using GS ( k
command, but I cannot see how.
W/BluetoothAdapter(23880): getBluetoothService() called with no BluetoothManagerCallback
D/BluetoothBasicPlugin(23880): stateStreamHandler, current action: android.bluetooth.device.action.ACL_CONNECTED
E/flutter (20762): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Bad state: Future already completed
E/flutter (20762): #0 _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
E/flutter (20762): #1 PrinterBluetoothManager.writeBytes. (package:esc_pos_bluetooth/src/printer_bluetooth_manager.dart:117:23)
E/flutter (20762):
E/flutter (20762): #2 PrinterBluetoothManager.writeBytes. (package:esc_pos_bluetooth/src/printer_bluetooth_manager.dart)
E/flutter (20762): #3 _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (20762): #4 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (20762): #5 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (20762): #6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (20762): #7 _DelayedData.perform (dart:async/stream_impl.dart:611:14)
E/flutter (20762): #8 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
E/flutter (20762): #9 _PendingEvents.schedule. (dart:async/stream_impl.dart:687:7)
E/flutter (20762): #10 _rootRun (dart:async/zone.dart:1182:47)
E/flutter (20762): #11 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (20762): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (20762): #13 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
E/flutter (20762): #14 _rootRun (dart:async/zone.dart:1190:13)
E/flutter (20762): #15 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (20762): #16 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (20762): #17 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
E/flutter (20762): #18 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (20762): #19 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (20762):
E/MethodChannel#flutter_bluetooth_basic/methods(23880): Failed to handle method call
E/MethodChannel#flutter_bluetooth_basic/methods(23880): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.cancel()' on a null object reference
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin.disconnect(FlutterBluetoothBasicPlugin.java:250)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin.onMethodCall(FlutterBluetoothBasicPlugin.java:113)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at android.os.MessageQueue.next(MessageQueue.java:330)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at android.os.Looper.loop(Looper.java:169)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at android.app.ActivityThread.main(ActivityThread.java:7094)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
E/MethodChannel#flutter_bluetooth_basic/methods(23880): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:928)
E/flutter (23880): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'void com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.cancel()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'void com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.cancel()' on a null object reference
E/flutter (23880): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin.disconnect(FlutterBluetoothBasicPlugin.java:250)
E/flutter (23880): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin.onMethodCall(FlutterBluetoothBasicPlugin.java:113)
E/flutter (23880): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (23880): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter (23880): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/flutter (23880): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (23880): at android.os.MessageQueue.next(MessageQueue.java:330)
E/flutter (23880): at android.os.Looper.loop(Looper.java:169)
E/flutter (23880): at android.app.ActivityThread.main(ActivityThread.java:7094)
E/flutter (23880): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (23880): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
E/flutter (23880): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:928)
only in iOS, android ok
Hello,
I installed the example in my phone:
https://github.com/andrey-ushakov/esc_pos_bluetooth/tree/master/example/blue
My phone is connected succesfully to the printer, but when i try to connect with esc_pos_bluetooth, this plugin don't find any devices, what is wrong?
Tks!!
Because every version of esc_pos_bluetooth depends on rxdart ^0.23.1 and month_picker_dialog 0.3.2 depends on rxdart ^0.24.0, esc_pos_bluetooth is incompatible with month_picker_dialog 0.3.2.
¿Can you update to the last rxdart? Thanks and sorry!
It does not find my printer, bixolon SPP-310, and it is already paired on my phone, the only thing it found was my smartwatch, it should scan any bluetooth device
i have try to change value queueSleepTimeMs in this line
Future printTicket(
Ticket ticket, {
int chunkSizeBytes = 50,
int queueSleepTimeMs = 100,
}) async {
can connect device only 1 second .. and then connection lost ...
my printer is NYEAR
Performing hot reload...
Reloaded 4 of 1325 libraries in 1,653ms.
D/BluetoothBasicPlugin(10907): start scan
D/BluetoothAdapter(10907): isLeEnabled(): ON
D/BluetoothLeScanner(10907): onScannerRegistered() - status=0 scannerId=8 mScannerId=0
E/flutter (10907): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (10907): #0 Iterable.first (dart:core/iterable.dart:520:7)
E/flutter (10907): #1 showToast (package:oktoast/src/core/toast.dart:45:34)
E/flutter (10907): #2 BasicLayout16State._testPrint (package:erp/basic_material_design/basic_layout_16.dart:288:5)
E/flutter (10907):
E/flutter (10907): #3 BasicLayout16State.build.. (package:erp/basic_material_design/basic_layout_16.dart:302:28)
E/flutter (10907): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
E/flutter (10907): #5 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36)
E/flutter (10907): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (10907): #7 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
E/flutter (10907): #8 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
E/flutter (10907): #9 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7)
E/flutter (10907): #10 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (10907): #11 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
E/flutter (10907): #12 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (10907): #13 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (10907): #14 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (10907): #15 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (10907): #16 _rootRunUnary (dart:async/zone.dart:1138:13)
E/flutter (10907): #17 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (10907): #18 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
E/flutter (10907): #19 _invoke1 (dart:ui/hooks.dart:273:10)
E/flutter (10907): #20 _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
E/flutter (10907):
D/BluetoothAdapter(10907): isLeEnabled(): ON
D/BluetoothBasicPlugin(10907): start scan
D/BluetoothAdapter(10907): isLeEnabled(): ON
D/BluetoothLeScanner(10907): onScannerRegistered() - status=0 scannerId=8 mScannerId=0
D/BluetoothAdapter(10907): isLeEnabled(): ON
D/BluetoothAdapter(10907): isLeEnabled(): ON
D/BluetoothLeScanner(10907): could not find callback wrapper
W/BluetoothAdapter(10907): getBluetoothService() called with no BluetoothManagerCallback
D/BluetoothBasicPlugin(10907): stateStreamHandler, current action: android.bluetooth.device.action.ACL_CONNECTED
E/DeviceConnFactoryManager(10907): wait read
E/flutter (10907): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (10907): #0 Iterable.first (dart:core/iterable.dart:520:7)
E/flutter (10907): #1 showToast (package:oktoast/src/core/toast.dart:45:34)
E/flutter (10907): #2 BasicLayout16State._testPrint (package:erp/basic_material_design/basic_layout_16.dart:288:5)
E/flutter (10907):
E/flutter (10907): #3 BasicLayout16State.build.. (package:erp/basic_material_design/basic_layout_16.dart:302:28)
E/flutter (10907): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
E/flutter (10907): #5 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36)
E/flutter (10907): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (10907): #7 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
E/flutter (10907): #8 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
E/flutter (10907): #9 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7)
E/flutter (10907): #10 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (10907): #11 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
E/flutter (10907): #12 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (10907): #13 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (10907): #14 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (10907): #15 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (10907): #16 _rootRunUnary (dart:async/zone.dart:1138:13)
E/flutter (10907): #17 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (10907): #18 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
E/flutter (10907): #19 _invoke1 (dart:ui/hooks.dart:273:10)
E/flutter (10907): #20 _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
E/flutter (10907):
D/BluetoothSocket(10907): close() this: android.bluetooth.BluetoothSocket@917d849, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@483854e, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@6f1b66fmSocket: android.net.LocalSocket@35aaf7c impl:android.net.LocalSocketImpl@4fcb005 fd:java.io.FileDescriptor@616a85a, mSocketState: CONNECTED
D/BluetoothSocket(10907): close() this: android.bluetooth.BluetoothSocket@917d849, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@483854e, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@6f1b66fmSocket: null, mSocketState: CLOSED
D/BluetoothSocket(10907): close() this: android.bluetooth.BluetoothSocket@917d849, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@483854e, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@6f1b66fmSocket: null, mSocketState: CLOSED
W/System.err(10907): java.io.IOException: bt socket closed, read return: -1
W/System.err(10907): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:523)
W/System.err(10907): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
W/System.err(10907): at java.io.InputStream.read(InputStream.java:101)
W/System.err(10907): at com.gprinter.io.BluetoothPort.readData(BluetoothPort.java:130)
W/System.err(10907): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.readDataImmediately(DeviceConnFactoryManager.java:418)
W/System.err(10907): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.run(DeviceConnFactoryManager.java:498)
E/BluetoothPort(10907): connection device is lost
E/DeviceConnFactoryManager(10907): read 0
D/BluetoothBasicPlugin(10907): stateStreamHandler, current action: android.bluetooth.device.action.ACL_DISCONNECTED
Getting error:
Because no versions of esc_pos_printer match >4.0.3 <5.0.0 and esc_pos_printer 4.0.3 depends on esc_pos_utils ^1.0.0, esc_pos_printer ^4.0.3 requires esc_pos_utils ^1.0.0.
And because esc_pos_bluetooth >=0.2.8 depends on esc_pos_utils ^0.3.6, esc_pos_printer ^4.0.3 is incompatible with esc_pos_bluetooth >=0.2.8.
So, because ticket_scan depends on both esc_pos_bluetooth ^0.2.8 and esc_pos_printer ^4.0.3, version solving failed.
pub get failed (1; So, because tibox depends on both esc_pos_bluetooth ^0.2.8 and esc_pos_printer ^4.0.3, version solving failed.)
I want to disconnect the printer after connected to one printer, No disconnect() method?
Tengo un problema para poder imprimir en una impresora zebra no la reconoce, como le puedo hacer para que me funcione.
I can only be able to print once, only when the app starts for the first time, subsequent attempts to print am getting Printer connection timeout
Here are the logs.
D/BluetoothBasicPlugin(31167): start scan
D/BluetoothAdapter(31167): STATE_ON
I/chatty (31167): uid=10277(ke.co.quebasetech.wanga_admin) identical 1 line
D/BluetoothAdapter(31167): STATE_ON
D/BluetoothLeScanner(31167): Start Scan with callback
D/BluetoothLeScanner(31167): onScannerRegistered() - status=0 scannerId=9 mScannerId=0
D/BluetoothAdapter(31167): STATE_ON
D/BluetoothAdapter(31167): STATE_ON
D/BluetoothLeScanner(31167): Stop Scan with callback
D/BluetoothAdapter(31167): STATE_ON
D/BluetoothAdapter(31167): STATE_ON
D/BluetoothLeScanner(31167): could not find callback wrapper
D/BluetoothSocket(31167): close() this: android.bluetooth.BluetoothSocket@2173db5, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@7b09c4a, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@10d47bbmSocket: android.net.LocalSocket@424b4d8 impl:android.net.LocalSocketImpl@9cb0031 fd:java.io.FileDescriptor@c643316, mSocketState: CONNECTED
W/System.err(31167): java.io.IOException: bt socket closed, read return: -1
D/BluetoothSocket(31167): close() this: android.bluetooth.BluetoothSocket@2173db5, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@7b09c4a, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@10d47bbmSocket: null, mSocketState: CLOSED
D/BluetoothSocket(31167): close() this: android.bluetooth.BluetoothSocket@2173db5, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@7b09c4a, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@10d47bbmSocket: null, mSocketState: CLOSED
W/System.err(31167): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:721)
W/System.err(31167): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:88)
W/System.err(31167): at java.io.InputStream.read(InputStream.java:101)
W/System.err(31167): at com.gprinter.io.BluetoothPort.readData(BluetoothPort.java:130)
W/System.err(31167): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.readDataImmediately(DeviceConnFactoryManager.java:418)
W/System.err(31167): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.run(DeviceConnFactoryManager.java:498)
E/BluetoothPort(31167): connection device is lost
E/DeviceConnFactoryManager(31167): read 0
D/BluetoothAdapter(31167): cancelDiscovery
D/BluetoothAdapter(31167): cancelDiscovery = true
D/BluetoothUtils(31167): isSocketAllowedBySecurityPolicy start : device null
W/BluetoothAdapter(31167): getBluetoothService() called with no BluetoothManagerCallback
E/DeviceConnFactoryManager(31167): wait read
E/BluetoothPort(31167): read length1
E/DeviceConnFactoryManager(31167): read 1
E/DeviceConnFactoryManager(31167): wait read
I/flutter (31167): Error. Printer connection timeout
Compiler message:
lib/main.dart:26:17: Error: 'Ticket' isn't a type.
Ticket ticket = Ticket(PaperSize.mm80);
^^^^^^
lib/main.dart:26:33: Error: The method 'Ticket' isn't defined for the class '_MyAppState'.
Hello, thank for your plugin!
How to add cyrillic symbols for printing?
I'm testing to see if the plugin can detect nearby Bluetooth devices but the device list is empty
write code to print only one qrcode but the result printed 2 qrcode.
My printer is IPOS PT2200B
With your library, I can't find my printer :(
With this library https://pub.dev/packages/blue_thermal_printer I found my printer but I don't know how to set Cyrillic symbols there.
I am trying to print a text and allways reverse is true and I set to value false and the same.. help me!
Hola buenas tardes, baje tu ejemplo de github y lo instale en mi celular pero al escanear las impresoras no me aparece la que tengo (Zebra mz220), ya probe la impreosar con una aplicacion que se llama ESC POST Print y si manda a imprimir las pruebas como lo puedo solucionar para que me aparezcan en la aplicacion de pruebas y la que estoy haciendo.
I have a phomemo m110 label printer. It uses esc_pos commands. However, only the feed functions works. I can't get any other function to work.
Hello everyone,
The package seems to not work when using targetSdkVersion 29
in android. I have not tried it in ios. My project is using sdk29.
To reproduce, change
defaultConfig { applicationId "com.example.blue" minSdkVersion 21 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" }
to
defaultConfig { applicationId "com.example.blue" minSdkVersion 21 targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" }
I added the following permission and it is still not working:
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
I need your help solving this problem.
Hello,
how can we check the status of a printer if for example the bluetooth printer gets turned off after we connect to it?
Hello, im using this library to be printed on A4. i've tweak the papersize value to get the right size for A4 paper but the problem is when i'm printing it, the result always have . on every new line of row. Please help! thank you.
Here's the link to preview the print result : https://ibb.co/6Rw1nhf
Hello, I try to use print on Bluetooth thermal printer from iOS.
the column seems to be indented and takes 2 lines.
I'm using eppos thermal printer using 58mm paper
my code (result with a red circle):
for (var i = widget.data.length - 1; i >= 0; i--) {
ticket.row([
PosColumn(
text: widget.data[i].qty.toString(), //+ ' ' + widget.data[i].productName,
width: 2,
// styles: PosStyles(align: PosAlign.left),
),
PosColumn(
text: widget.data[i].productName,
width: 4,
styles: PosStyles(align: PosAlign.left),
),
PosColumn(
text: numSeparator(widget.data[i].subTotal),
width: 4,
styles: PosStyles(align: PosAlign.right),
),
PosColumn(
text: '',
width: 2,
styles: PosStyles(align: PosAlign.right),
),
]);
}
Device list is empty when I try to Scan getting this error status=0 scannerId=9 mScannerId=0 or status=0 scannerId=11 mScannerId=0
i have problem to find device.
i think this library must show all bounded devices to connect instead of scan
is possible add this method to this library ?
thanks
greeting iam using zebra zq320 i managed to print arabic text but he problem is the text was too long there will be a problem that not all the text is printed i tried to split the next to several part for example the code blew i tried to send it 3 times first 2 will print correct third will print maybe 1 or 2 lines from it
iam using zpl lang
i tried even to change the
chunkSizeBytes,queueSleepTimeMs
but no hope can anyone suggest
zplData="";
zplData = zplData + " ^XA^CWZ,E:TT0003M_.FNT^FS";
zplData = zplData + "^MNN^LL800";
for(int i=10;i<20;i++)
{
zplData = zplData + " ^FO05," + start.toString() + "^CI28^AZN,30,30^FD "+i.toString()+" ^FS";
zplData = zplData + " ^FO140," + start.toString() + "^CI28^AZN,30,30^FD 20" + " ^FS";
zplData = zplData + " ^FO230," + start.toString() + "^CI28^AZN,30,30^FD 500" + " ^FS";
zplData = zplData + " ^FO385," + start.toString() + "^CI28^AZN,30,30^FD حليب تنوفا 2 لتر" + " ^FS";
start = start + lineSpace;
}
zplData = zplData + " ^FO05," + start.toString() + "^CI28^AZN,30,30^FD ______________________________________" + " ^FS";
zplData = zplData + " ^XZ";
Uint8List encArabic1 = await CharsetConverter.encode("UTF-8",zplData);
ticket.textEncoded(encArabic1,
styles: PosStyles(codeTable: PosCodeTable.arabic));
Connection timeout issue when print continuously.
I simply need to print a much larger number, using the embedded sizes in your package (size1 to size8), I probably need a size32. I need it to be 3X or 4X size 8.
How can I achieve that plz?
I'm successfully connecting + printing with a Bluetooth Thermal printer model: NCTS-RBP4
Facing issue problem though: getBluetoothService() called with no BluetoothManagerCallback
Printer itself does not cut, did not yet tried printing Barcodes/Images etc etc or done any intensive testing.
Is it possible to bump to the latest esc_pos_utils? In our app we use both esc_pos_bluetooth and esc_pos_printer and we cannot upgrade esc_pos_printer to the latest version because esc_pos_bluetooth is stuck at esc_pos_utils: ^0.3.6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.