AmolGangadhare / flutter_barcode_scanner

Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
https://pub.dev/packages/flutter_barcode_scanner
MIT License
380 stars 499 forks source link

FlutterBarcodeScanner unable to catch Camera not available exception #87

Closed Xgamefactory closed 3 years ago

Xgamefactory commented 4 years ago

when trying to run await FlutterBarcodeScanner.scanBarcode unable to catch this exception plugin just shows alert dialog and not rethrow error

String res;
    try {
      res = await FlutterBarcodeScanner.scanBarcode(
          "#F04F33", "Cancel", true, ScanMode.BARCODE);
    } on PlatformException catch (e) {
//never calling
      throw Exception(e.message);
    }
AmolGangadhare commented 4 years ago

Thanks for reporting the issue. Can you add some error logs, please?

Currently, V1.0.0 has been released, can you try it on the latest version?

Xgamefactory commented 4 years ago

instead of showing dialog in plugin side it would be nice to throw error so developers can catch it.

AmolGangadhare commented 3 years ago

The errors are managed in the native part for both android and ios as the scanning is done in the native part. Currently, there is no functionality to get the error from the native to the flutter app as the required permissions/ error handling is already done at the native code.

AmolGangadhare commented 3 years ago

Closing this as there is no response. Feel free to open a new issue.