Barcode scanner in Flutter

Aseem Wangoo
CodeChai
Published in
2 min readJul 6, 2018

Barcode scanner in Flutter

All in one Flutter Resource: https://flatteredwithflutter.com/barcode-scanner-in-flutter/

BarCode Scanning

Going through variety of articles on internet, I struck upon the common use case of scanning/reading BarCodes..I always wanted to try this in Android, but always procrastinated, not until now…..

Barcode Scanner App

Searching through the flutter packages until I found barcode_scan.

Let’s Begin

Add dependency

Add the dependency of barcode_scan : “0.0.4” in pubspec.yaml.

Next, add the following line in the Android Manifest of your app

<activity android:name="com.apptreesoftware.barcodescan.BarcodeScannerActivity"/>

Activity added in Android Manifest.xml

When, you click on Capture Image button, scanning of barcode takes initialization….

It asks you for accessing the Camera permission. If denied, then response is returned on the UI, with

Error if not given permission…

If given permission, it starts scanning the image with barcode and if found returns the number onto the screen…

Barcode scanned….

Code snippet for scanning barcode :

Scanning barcode.

Articles related to Flutter:

Find the complete program at

P.S………………………………

The Flutter Pub is a medium publication to bring you the latest and amazing resources such as articles, videos, codes, podcasts etc. about this great technology to teach you how to build beautiful apps with it. You can find us on Facebook, Twitter, and Medium or learn more about us here. We’d love to connect! And if you are a writer interested in writing for us, then you can do so through these guidelines.

--

--