Git Product home page Git Product logo

qr_code_dart_scan's Introduction

pub package

QRCodeDartScan

A QR code scanner that works on both iOS and Android using dart decoder.

Scanning normal Qr code Scanning invert Qr code

APK DEMO

Features

  • Camera scan preview in a widget
  • Scan QRCode
  • Scan invert QRCode

Supported platforms

This package is limited per camera pluggin support.

Platform Scan live Scan take picture
Android
IOS
WEB
Windows
MacOS
Linux

Supported Formats

  • QR_CODE
  • AZTEC
  • DATA_MATRIX
  • PDF_417
  • CODE_39
  • CODE_93
  • CODE_128
  • EAN_8
  • EAN_13

Installation

First, add qr_code_dart_scan as a dependency in your pubspec.yaml file.

iOS

iOS 10.0 of higher is needed to use the camera plugin. If compiling for any version lower than 10.0 make sure to check the iOS version before using the camera plugin. For example, using the device_info plugin.

Add two rows to the ios/Runner/Info.plist:

  • one with the key Privacy - Camera Usage Description and a usage description.
  • and one with the key Privacy - Microphone Usage Description and a usage description.

Or in text format add the key:

<key>NSCameraUsageDescription</key>
<string>Can I use the camera please?</string>
<key>NSMicrophoneUsageDescription</key>
<string>Can I use the mic please?</string>

Android

Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.

minSdkVersion 21

It's important to note that the MediaRecorder class is not working properly on emulators, as stated in the documentation: https://developer.android.com/reference/android/media/MediaRecorder. Specifically, when recording a video with sound enabled and trying to play it back, the duration won't be correct and you will only see the first frame.

Using

    return Scaffold(
      body: QRCodeDartScanView(
        scanInvertedQRCode: true, // enable scan invert qr code ( default = false)
        
        typeScan: TypeScan.live, // if TypeScan.takePicture will try decode when click to take a picture(default TypeScan.live)
        // intervalScan: const Duration(seconds:1)
        // onResultInterceptor: (old,new){
        //  do any rule to controll onCapture.
        // }
        // takePictureButtonBuilder: (context,controller,isLoading){ // if typeScan == TypeScan.takePicture you can customize the button.
        //    if(loading) return CircularProgressIndicator();
        //    return ElevatedButton(
        //       onPressed:controller.takePictureAndDecode,
        //       child:Text('Take a picture'),
        //    );
        // }
        // resolutionPreset: = QrCodeDartScanResolutionPreset.high,
        // formats: [ // You can restrict specific formats.
        //  BarcodeFormat.qrCode,
        //  BarcodeFormat.aztec,
        //  BarcodeFormat.dataMatrix,
        //  BarcodeFormat.pdf417,
        //  BarcodeFormat.code39,
        //  BarcodeFormat.code93,
        //  BarcodeFormat.code128,
        //  BarcodeFormat.ean8,
        //  BarcodeFormat.ean13,
        // ],
        onCapture: (Result result) {
          // do anything with result
          // result.text
          // result.rawBytes
          // result.resultPoints
          // result.format
          // result.numBits
          // result.resultMetadata
          // result.time
        },
      ),
    );
    

Decoder

You may use only the our decoder if you want:

  final decoder = QRCodeDartScanDecoder(
    // formats: [ // You can restrict specific formats.
    //  BarcodeFormat.qrCode,
    //  BarcodeFormat.aztec,
    //  BarcodeFormat.dataMatrix,
    //  BarcodeFormat.pdf417,
    //  BarcodeFormat.code39,
    //  BarcodeFormat.code93,
    //  BarcodeFormat.code128,
    //  BarcodeFormat.ean8,
    //  BarcodeFormat.ean13,
    // ],
  );

  Result? result = await decoder.decodeCameraImage(CameraImage());

  // or

  Result? result = await decoder.decodeFile(XFile());

qr_code_dart_scan's People

Contributors

mateuslucasdasilva avatar philseeley avatar rafaelbarbosadrip avatar rafaelbarbosatec avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.