RafaelBarbosatec / qr_code_dart_scan

A QR code scanner that works on both iOS and Android using dart decoder.
MIT License
15 stars 20 forks source link

the class CameraImage does not have unnamed constructor #17

Closed aimeykra closed 4 months ago

aimeykra commented 5 months ago

I am trying to use this package to simply scan a QR code and get the text content in Dart code. I do not want to display a view widget . I just need the text result and do something with it.

This line of code: Result? result = await decoder.decodeCameraImage(CameraImage());

Is throwing Dart parse error : class CamareImage does not have unnamed constructor. I checked the camera.dart package and indeed the constructor to use is CameraImage.fromPlatformInterface(). But do i get the CameraImageData parameter that i need to pass to this named constructor?

Thanks for feedback. Kay

RafaelBarbosatec commented 5 months ago

Hi @aimeykra ! Thanks for contacting! So, if you want just decode a image file to get the qrcode information, you can use decoder.decodeFile(XFile())