How to store a scanned bar/qr code as text file in flutter

Hi everyone,
I have a created basic flutter scanner app. I can able to scan the bar/qr code. Now I would like to store the scanned code in to a text file. How can I achieve it in flutter?

thanks

@NirmalaSudhir the way I see it is like you always use the barcode to either make an API call to fetch more information about a product or something.

You can additionally use shared preferences to locally store the data you get from barcode scanning.

Is there anything else you are looking for.

Does this help?

1 Like

@ashish173 Many thanks for replying me. I have no idea about bar code. I just started to work with flutter and just now I am in a situation need to create a bar code, scan it , store the scanned result (in some format) and send it to odoo db(to store in a configurable email address).

Is there any video tutorial of doing the above mentioned? A step by step tutorial I mean for a newbie like me.I will really appreciate your help

thanks

2 Likes

Unfortunately, I am unaware if there is a tutorial like that. But I think the way to go about it is pretty straightforward.

Use this library and you will get the barcode in the code.
Then you can just make an API call to Odoo(using JSON APIs).

Just in case you need more help you can reach out to @sakina she has actually worked on a flutter application to read the barcode and has experience with odoo API’s as well.

1 Like

@ashish173 Thanks for your update . I will get in touch with @sakina. Hope I get help from her.

@sakina
Hi Sakina,
I am here to ask you a help regarding flutter bar code scanning. I have an flutter app which is now able to scan the bar code. Next thing is I would like to store it in flutter(in some format) and then send it to odoo backend. I would be really glad if you guide me on this.

Note: @ashish173 referred you :slight_smile:
waiting for your reply

thanks in advance

Hi @NirmalaSudhir ! Yes I can definitely help you with this. :slight_smile:

I have used barcode_scan .

Here’s the code I have used. As you can see the variable barcode holds the value of barcode after being scanned. Now you can use this barcode and send it to backend using http request. I am assuming you know how to make API requests in Flutter, if you need any guidance in this area, please let me know.

  scan() async {
    try {
      String scannedBarcode = await BarcodeScanner.scan();
      setState(() {
        barcode = scannedBarcode;
      });
    } on PlatformException catch (e) {
      if (e.code == BarcodeScanner.CameraAccessDenied) {
        print("Please give camera access to scan!")
      } else {
        setState(() {
          scanned = false;
        });
      }   } on FormatException {
    } catch (e) {
    }
  }
1 Like

Hi @sakina ,

I have used this below link for bar code scanning

https://github.com/iampawan/FlutterQRScanner-App/blob/master/lib/main.dart

I can able scan the bar code. Next thing is want to store it in a file with a format something like PDF or image and send it to odoo(with configrable mail address).
Question : Is there any way that I can store the scanned bar code result in PDF or image format?

Hope you understand what I mean.
thanks
Nirmala Sudhir