Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter barcode_scan unable to get a response

Tags:

flutter

I'm using the barcode_scan package to get barcode information.

barcode_scan: ^3.0.1

I have a super simple test scenario set up like this:

ScanResult result = await BarcodeScanner.scan();
print(result.rawContent); 

I see the barcode scanner screen show up, and it appears to detect the barcode because as soon as I focus on the barcode it pauses and the closes the barcode scanner screen. however, it never reaches the line below print(result.rawContent); I'm not seeing any errors either. I've tried wrapping the whole thing in a try catch just to see, but it never entered the catch. It's like it just doesn't return anything from the await BarcodeScanner.scan() call and just aborts completely.

I'm not sure what I'm doing wrong here.

like image 393
cloudwalker Avatar asked May 21 '20 01:05

cloudwalker


Video Answer


2 Answers

I solved downgrading barcode_scan from 3.0.1 to 2.0.0.

I hope it helps

like image 167
Marco Zoratti Avatar answered Oct 07 '22 09:10

Marco Zoratti


I meet the same issue on my existing project was created on old version of flutter, when I create new project with last version of flutter(1.12.x-pre) it is work find.

  • flutter(1.12.x-pre) down can use barcode_scan: ^2.x.x
  • flutter(1.12.x-pre) up can use barcode_scan: ^3.x.x

It is not bug, I just found new issue on barcode_scan.

Issue: https://github.com/mintware-de/flutter_barcode_reader/issues/261#issue-643704981

I'm a newer of flutter.

like image 3
Eang Lay Avatar answered Oct 07 '22 09:10

Eang Lay