qrscan 0.2.17

  • Readme
  • Changelog
  • Example
  • Installing
  • 96

Language: English | 中文简体

QR Code Scanner #

License Pub

A Flutter plugin 🛠 to scanning. Ready for Android 🚀

github

qrscan.gif

Permission: #

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
 qrscan: ^0.2.17

Scan Usage example #

import 'package:qrscan/qrscan.dart' as scanner;

String cameraScanResult = await scanner.scan();

Supported #

  • [x] Scan BR-CODE
  • [x] Scan QR-CODE
  • [x] Control the flash while scanning
  • [x] Apply for camera privileges
  • [x] Scanning BR-CODE or QR-CODE in albums
  • [x] Parse to code string with uint8list
  • [x] Scanning the image of the specified path
  • [x] Display the switch button of the flashlight according to the light intensity
  • [x] Generate QR-CODE

Features #

  • Generate BR-CODE
  • Support IOS

Demo App #

qrscan.gif

Select Bar-Code or QR-Code photos for analysis and Generating QR-Code #

import 'package:qrscan/qrscan.dart' as scanner;

// Select Bar-Code or QR-Code photos for analysis
String photoScanResult = await scanner.scanPhoto();

// Generating QR-Code
Uint8List result = await scanner.generateBarCode('https://github.com/leyan95/qrcode_scanner');

// Scanning the image of the specified path
String barcode = await scanner.scanPath(path);

// Parse to code string with uint8list
File file = await ImagePicker.pickImage(source: ImageSource.camera);
Uint8List bytes = file.readAsBytesSync();
String barcode = await scanner.scanBytes(uint8list);

Contribute #

We would ❤️ to see your contribution!

License #

Distributed under the MIT license. See LICENSE for more information.

About #

Created by Shusheng.

0.0.1 - (2019/04/7) #

0.0.2 - (2019/04/7) #

0.0.3 - (2019/04/7) #

0.1.0 - (2019/04/8) #

0.1.1 - (2019/04/8) #

0.1.2 - (2019/04/8) #

0.1.3 - (2019/04/8) #

0.1.4 - (2019/04/11) #

0.1.5 - (2019/04/29) #

0.1.6 - (2019/05/18) #

0.1.7 - (2019/08/01) light up back view #

0.1.8 - (2019/08/01) update style #

0.1.9 - (2019/08/01) update style #

0.2.0 - (2019/08/01) update style #

0.2.1 - (2019/08/03) Adjust the layout #

0.2.2 - (2019/08/05) Apply for camera privileges #

0.2.3 - (2019/08/05) Scanning BR-CODE and QR-CODE in albums #

0.2.4 - (2019/08/05) #

0.2.5 - (2019/08/07) Display the switch button of the flashlight according to the light intensity #

0.2.6 - (2019/08/07) #

0.2.7 - (2019/08/07) #

0.2.8 - (2019/08/07) Generate QR-CODE #

0.2.9 - (2019/08/09) Update demo style #

0.2.10 - (2019/08/09) Update Readme #

0.2.11 - (2019/08/14) Update Readme #

0.2.12 - (2019/08/19) Migrate to AndroidX #

0.2.13 - (2019/08/20) Migrate to AndroidX #

0.2.14 - (2019/08/24) Repair the problem of scanned pictures #

0.2.15 - (2019/08/30) Select photo on the scan page to scanning. #

0.2.16 - (2019/09/06) Scanning the image of the specified path. #

0.2.17 - (2019/09/06) Parse to code string with uint8list. #

example/README.md

qrscan_example #

import 'dart:async';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:qrscan/qrscan.dart' as scanner;

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String barcode = '';
  Uint8List bytes = Uint8List(200);

  @override
  initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Qrcode Scanner Example'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.end,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              SizedBox(
                width: 200,
                height: 200,
                child: Image.memory(bytes),
              ),
              Text('RESULT  $barcode'),
              RaisedButton(onPressed: _scan, child: Text("Scan")),
              RaisedButton(onPressed: _scanPhoto, child: Text("Scan Photo")),
              RaisedButton(onPressed: _generateBarCode, child: Text("Generate Barcode")),
            ],
          ),
        ),
      ),
    );
  }

  Future _scan() async {
    String barcode = await scanner.scan();
    setState(() => this.barcode = barcode);
  }

  Future _scanPhoto() async {
    String barcode = await scanner.scanPhoto();
    setState(() => this.barcode = barcode);
  }

  Future _generateBarCode() async {
    Uint8List result = await scanner.generateBarCode('https://github.com/leyan95/qrcode_scanner');
    this.setState(() => this.bytes = result);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  qrscan: ^0.2.17

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:qrscan/qrscan.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
93
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
96
Learn more about scoring.

We analyzed this package on Nov 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
test ^1.5.1
test_coverage ^0.2.0