mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 463 forks source link

Android back button without scanning: FormatException (FormatException: Invalid envelope) #177

Closed sgehrman closed 4 years ago

sgehrman commented 4 years ago

Exception has occurred. FormatException (FormatException: Invalid envelope)

pkcpkc commented 4 years ago

Me got the same problem: Pressing back button without scanning results in the FormatException: Invalid envelope.

I guess in this case there might be a null value involved when returning from BarcodeScanner.scan()

Interesting enough: The FormatException only occurs in debug mode - running the app without debugger attached this error is not thrown on back button.

eric-5512 commented 4 years ago

I not look Back Button

devtronic commented 4 years ago

In the current dev release the scan() method returns a result object which contains a resulttype.cancelled instead of throwing an exception: https://pub.dev/packages/barcode_scan/versions/3.0.0-dev.1