mintware-de / flutter_barcode_reader

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

[Feature Request] Send/Select an image to scan it #252

Open rlazom opened 4 years ago

rlazom commented 4 years ago

Basically what I mean is, could be a good alternative for the web, instead of reading from the webcam, send an image (file or image data) and just decode it, like the current code (but instead of scan from the camera, scan from a selected image file).

So I propose add a new function "selectFile" or something like that. You can get the file (on the web platform) with this code:

    Future<File> uploadElement() async {
      final FileUploadInputElement input = FileUploadInputElement();
      input..accept = 'image/*';
      input.click();
      await input.onChange.first;
      if (input.files.isEmpty) return null;
      return input.files[0];
    }

With this file you can draw the image from an attribute (I think is data).

Other plugin alternatives suck, and the one who can do this feature, receive a file path, and you can not get the path of a selected file on the web platform...

So that's it, Thanks in advance