QR Code Creating, Scanning in Flutter: A Complete Guide

Table of Contents

QR Code :

QR Code i.e., Rapid Response codes are made use of to offer information in the speediest way achievable these kinds of that when person scans the code information and facts is been given onto their gadget.

There is a vast usage of these codes which are related to that of the barcodes employed for products and solutions, commodities to get the product or service facts.

In banking app’s these scanners are typically employed to make transactions super quick and convenient for even typical gentleman.

In this web site we will be working with the generation of QR Code and scanning it much too in flutter application.

 

pubspec.yml :

Add the demanded dependencies to your flutter project for producing and scanning QR codes.

qr_flutter: ^4..
qrscan: ^.3.3

 

main.dart :

import 'package:flutter/material.dart'
import 'package:qr_flutter/qr_flutter.dart'
import 'package:qrscan/qrscan.dart' as scan

void key()
  runApp(MyApp())


course MyApp extends StatefulWidget 
  const MyApp(Crucial? crucial) : super(essential: vital)

  @override
  State createState() => _MyAppState()


course _MyAppState extends Condition 

  late String scannedMsg=""
  TextEditingController controller = TextEditingController()

  @override
  Widget build(BuildContext context) 
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      dwelling: Scaffold(
        appBar: AppBar(title: const Textual content("QR Generator"),),
        human body: Column(
          little ones: [

            const SizedBox(height: 50,),
            TextField(
              controller: controller,
              decoration: const InputDecoration(
                border: OutlineInputBorder(),
                labelText: 'Enter your string'
              ),
            ),

            const SizedBox(height: 30,),
            TextButton(onPressed: ()
              setState(()  
              );
            , child: const Text("Generate QR")),
            TextButton(onPressed: ()
              scanQr();

            , child: const Text("Scan QR")),

            const SizedBox(height: 50,),
            Text(scannedMsg),
            const SizedBox(height: 100,),
            QrImage(data: controller.text,
              size: 200.0,
            )
          ],
        ),
      ),
    )
  

  void scanQr() async
    String? scanResult = await scan.scan()
    scannedMsg = scanResult.toString()
    setState(() 

    )
  



 

Next Post

How to Keep Your Pipeline Full

How many actions does it take before a lead converts into a customer? Related Posts:Flutter Lottie Master Flutter Animations : Your Complete Guide
How to Keep Your Pipeline Full

You May Like