Check Mobile App
Read now
Start a Project

QR Code Scanner in Flutter

Save

Getting to websites, pictures, and records using QR codes is broadly utilized these days. These QR Codes are used in various daily used apps like BHIM, PhonePe, Paytm, google pay and numerous more and it’s quite easy to build QR Code Scanner in Flutter. Most of the shops, restaurants and bars have started to replace paper menus with QR codes, and retailers now allow you to pay with a QR code rather than touching anything.

In today’s article, we are going to describe how to build QR code scanner in Flutter apps for android and iOS. There are many packages available but we are going to use qr_code_scanner plugin. Currently this plugin supports android, iOS and web. While I evaluated various barcode scanning apps that didn’t use Google Services (or the ML Kit Vision API), they had certain limitations, such as requiring your app to support Android 7 or newer. Other initiatives appeared to have been abandoned.


Follow the underneath steps to construct a straightforward QR scanner flutter application:

Implementation of QR Code Scanner in Flutter

Step 1. Initial setup


Import “qr_code_scanner: ^latest_version” package in your pubspec.yaml file under dependencies like

The most recent version is 0.6.1. Before importing package version, please make sure that you have the most recent one in your pubspec.yaml file.

Step 2. Import Package


Import QR code scanner package path in the class file, where you need to use this package


Step 3. Integration

Android Integration 

To use this dependency, please update the Gradle, Kotlin and Kotlin Gradle Plugin:

Go to project level gradle file and change ext.kotlin_version = '1.3.50' to ext.kotlin_version = '1.5.0'

In android/build.gradle change classpath 'com.android.tools.build:gradle:3.5.0' to classpath 'com.android.tools.build:gradle:4.2.0'

In app/build.gradle change minSdkVersion 16 to minSdkVersion 21

if you don’t upgrade the kotlin, gradle and min sdk verison you will get the error like

iOS Integration

Add the following permissions into your info.plist file in iOS package of your project

Web Integration

Add the following code into your Web/index.html file


Step 4.

You can use following code to create QR code view in your app


Step 5.

For getting result data from QR Code scanner, you can use the following code

It’s done!

Please let us know if you have any questions or concerns in the comments area.

You can go through our latest blogs on – https://mobikul.com/blog/

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.

Stathis Plakidas

Stathis Plakidas

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home