pszklarska / beacon_broadcast

A Flutter plugin for turning your device into a beacon.
https://pub.dartlang.org/packages/beacon_broadcast/
MIT License
81 stars 34 forks source link

Error Handling in Dart #12

Open nyiyui opened 4 years ago

nyiyui commented 4 years ago

Hello and thank you for making this library. I currently have an issue where is an error occurs, the error is not passed onto Dart (i.e. can't catch it using try, catchError, etc), but appears on the console:

Performing hot reload...
Syncing files to device blah-blah...
Reloaded 1 of 512 libraries in 809ms.
D/BeaconParser( 7318): Parsing beacon layout: blah-blah-blah
D/BluetoothAdapter( 7318): isLeEnabled(): ON
D/BluetoothAdapter( 7318): isLeEnabled(): ON
E/BeaconTransmitter( 7318): Advertisement start failed, code: 2

Just passing the error code as a return variable (instead of Future<void>, then await/then) would be fine for my use case, but it if you have the time to do it, please change the code so programs can catch the error.

Here is a Stack Overflow question about the same issue.

Thank you in advance.