Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

printerManager.startScan() Errors after 0.4.0 update #91

Closed
jobypthomas opened this issue Sep 26, 2021 · 7 comments
Closed

printerManager.startScan() Errors after 0.4.0 update #91

jobypthomas opened this issue Sep 26, 2021 · 7 comments

Comments

@jobypthomas
Copy link

jobypthomas commented Sep 26, 2021

@andrey-ushakov @RangerOfGondor
After migrating to Version 0.4.0, when running scan() command, I am getting the following error (with the example code in the repo):

E/flutter ( 9214): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: type 'Null' is not a subtype of type 'bool' in type cast
E/flutter ( 9214): #0      _$BluetoothDeviceFromJson
package:flutter_bluetooth_basic/src/bluetooth_device.g.dart:14
E/flutter ( 9214): #1      new BluetoothDevice.fromJson
package:flutter_bluetooth_basic/src/bluetooth_device.dart:15
E/flutter ( 9214): #2      BluetoothManager.scan.<anonymous closure>
package:flutter_bluetooth_basic/src/bluetooth_manager.dart:94
E/flutter ( 9214): #3      _MapStream._handleData (dart:async/stream_pipe.dart:213:31)
E/flutter ( 9214): #4      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
E/flutter ( 9214): #5      _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter ( 9214): #6      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 9214): #7      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter ( 9214): #8      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter ( 9214): #9      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 9214): #10     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:378:25)
E/flutter ( 9214): #11     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:244:5)
E/flutter ( 9214): #12     _DoStreamSink.add
package:rxdart/…/transformers/do.dart:40
E/flutter ( 9214): #13     forwardStream.<anonymous closure>.<anonymous closure>.<anonymous closure>
package:rxdart/…/utils/forwarding_stream.dart:31
E/flutter ( 9214): #14     forwardStream.runCatching
package:rxdart/…/utils/forwarding_stream.dart:21
E/flutter ( 9214): #15     forwardStream.<anonymous closure>.<anonymous closure>
package:rxdart/…/utils/forwarding_stream.dart:31
E/flutter ( 9214): #16     _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter ( 9214): #17     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 9214): #18     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter ( 9214): #19     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter ( 9214): #20     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 9214): #21     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:378:25)
E/flutter ( 9214): #22     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:244:5)
E/flutter ( 9214): #23     _TakeUntilStreamSink.add
package:rxdart/…/transformers/take_until.dart:13
E/flutter ( 9214): #24     forwardStream.<anonymous closure>.<anonymous closure>.<anonymous closure>
package:rxdart/…/utils/forwarding_stream.dart:31
E/flutter ( 9214): #25     forwardStream.runCatching
package:rxdart/…/utils/forwarding_stream.dart:21
E/flutter ( 9214): #26     forwardStream.<anonymous closure>.<anonymous closure>
package:rxdart/…/utils/forwarding_stream.dart:31
E/flutter ( 9214): #27     _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter ( 9214): #28     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 9214): #29     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter ( 9214): #30     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter ( 9214): #31     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 9214): #32     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
E/flutter ( 9214): #33     _MapStream._handleData (dart:async/stream_pipe.dart:218:10)
E/flutter ( 9214): #34     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
E/flutter ( 9214): #35     _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter ( 9214): #36     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 9214): #37     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter ( 9214): #38     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter ( 9214): #39     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 9214): #40     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
E/flutter ( 9214): #41     _WhereStream._handleData (dart:async/stream_pipe.dart:195:12)
E/flutter ( 9214): #42     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
E/flutter ( 9214): #43     _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter ( 9214): #44     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 9214): #45     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter ( 9214): #46     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter ( 9214): #47     _DelayedData.perform (dart:async/stream_impl.dart:591:14)
E/flutter ( 9214): #48     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
#49     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
#50     _rootRun (dart:async/zone.dart:1420:47)
#51     _CustomZone.run (dart:async/zone.dart:1328:19)
#52     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#53     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#54     _rootRun (dart:async/zone.dart:1428:13)
#55     _CustomZone.run (dart:async/zone.dart:1328:19)
#56     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#57     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#58     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#59     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
3
find device -> Printer001
find device -> N0A78
5
find device -> Printer001
@jobypthomas
Copy link
Author

jobypthomas commented Sep 26, 2021

@andrey-ushakov I tried with iOS and Android both the same behavior. However I see that it found the devices (Printer001 and N0A78, see above ) after the exception.

@jobypthomas
Copy link
Author

jobypthomas commented Sep 27, 2021

@andrey-ushakov The error is raised at the dependency - https://pub.dev/packages/flutter_bluetooth_basic
The function "_$BluetoothDeviceFromJson" in "bluetooth_device.dart" json['connected'] is returning null which the program is casted to bool raising the error.

@manimathma
Copy link

I am facing the same issue :(

@jobypthomas
Copy link
Author

@andrey-ushakov Any update on the fix?

@andrey-ushakov
Copy link
Owner

A PR was accepted, it should solve the issue.
As I don't have a pos printer currently, it becomes hard to test and maintain the package.
Your PRs are always welcome!! :)

Don't hesitate to reopen the issue if need.

@jobypthomas
Copy link
Author

jobypthomas commented Oct 4, 2021

@andrey-ushakov would you update the dependencies (flutter_bluetooth_basic fixed version?) and release the new version of esc_pos_bluetooth?

@andrey-ushakov
Copy link
Owner

Both packages, flutter_bluetooth_basic and esc_pos_bluetooth were published to pub.dev.
Thank you @jobypthomas for your valuable comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants