qr_mobile_vision 0.2.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 97

QR Mobile Vision #

pub package

Reading QR codes and other barcodes using Google's Mobile Vision API.

This plugin uses Android & iOS native APIs for reading images from the device's camera. It then pipes these images both to the Mobile Vision API which detects barcodes/qrcodes etc, outputs a preview image to be shown on a flutter texture.

The plugin includes a widget which performs all needed transformations on the camera output to show within the defined area.

Usage #

See the example for how to use this plugin; it is the best resource available as it shows the plugin in use. However, these are the steps you need to take to use this plugin.

First, figure out the area that you want the camera preview to be shown in. This is important as the preview needs to have a constrained size or it won't be able to build. This is required due to the complex nature of the transforms needed to get the camera preview to show correctly on both iOS and Android, while still working with the screen rotated etc.

It may be possible to get the camera preview to work without putting it in a SizedBox or Container, but the recommended way is to put it in a SizedBox or Container.

You then need to include the package and instantiate the camera.

import 'package:qr_mobile_vision/qr_camera.dart';

...

new SizedBox(
  width: 300.0,
  height: 600.0,
  child: new QrCamera(
    qrCodeCallback: (code) {
      ...
    },
  ),
)

The QrCodeCallback can do anything you'd like, and wil keep receiving QR codes until the camera is stopped.

There are also optional parameters to QrCamera.

fit #

Takes as parameter the flutter BoxFit. Setting this to different values should get the preview image to fit in different ways, but only BoxFit = cover has been tested extensively.

notStartedBuilder #

A callback that must return a widget if defined. This should build whatever you want to show up while the camera is loading (which can take from milliseconds to seconds depending on the device).

child #

Widget that is shown on top of the QrCamera. If you give it a specific size it may cause weird issues so try not to.

key #

Standard flutter key argument. Can be used to get QrCameraState with a GlobalKey.

offscreenBuilder #

A callback that must return a widget if defined. This should build whatever you want to show up when the camera view is 'offscreen'. i.e. when the app is paused. May or may not show up in preview of app.

onError #

Callback for if there's an error.

'formats' #

A list of supported formats, all by default. If you use all, you shouldn't define any others.

These are the supported types:

  ALL_FORMATS,
  AZTEC,
  CODE_128,
  CODE_39,
  CODE_93,
  CODABAR,
  DATA_MATRIX,
  EAN_13,
  EAN_8,
  ITF,
  PDF417,
  QR_CODE,
  UPC_A,
  UPC_E

Push and Pop #

If you push a new widget on top of a the current page using the navigator, the camera doesn't necessarily know about it.

Contributions #

Anyone wanting to contribute to this project is very welcome to! I'll take a look at PR's as soon as I can, and any bug reports are appreciated. I've only a few devices on which to test this so feedback about other devices is appreciated as well.

This has been tested on:

  • Nexus 5x
  • Nexus 4
  • Alcatel Idol X Plus
  • Essential Phone
  • iPhone 6

[0.2.2] - March 5, 2019

  • Fix detector for older phones as it wouldn't work if the returned preview size wasn't the same as what it requested.

  • Fix lint warnings

[0.2.1] - March 5, 2019

  • Changes to Android Camera2 buffer system so that new buffers aren't being allocated constantly but rather the same buffers are reused.

[0.2.0] - March 4, 2019

  • Upgrade to AndroidX, hopefully fix an android crash issue and autofocus on some devices.

[0.1.0] - Sept 28, 2018

  • Switch to different method of camera capture for Camera2. Might be some cases where this fails, but shouldn't. The camera2 api is a bit weird about image formats, but the one being used should be supported by all phones.

    Also switched to using continuous autofocus if supported. Should hopefully have better usability on some devices than before.

[0.0.1] - June 5, 2018

  • Initial release that supports scanning all types of barcodes that the QR Mobile Vision library supports.

example/README.md

qr_mobile_vision_example #

Demonstrates how to use the qr_mobile_vision plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  qr_mobile_vision: ^0.2.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:qr_mobile_vision/qr_mobile_vision.dart';
  
Version Uploaded Documentation Archive
0.2.2 Mar 6, 2019 Go to the documentation of qr_mobile_vision 0.2.2 Download qr_mobile_vision 0.2.2 archive
0.2.1 Mar 5, 2019 Go to the documentation of qr_mobile_vision 0.2.1 Download qr_mobile_vision 0.2.1 archive
0.2.0 Mar 5, 2019 Go to the documentation of qr_mobile_vision 0.2.0 Download qr_mobile_vision 0.2.0 archive
0.1.0 Sep 28, 2018 Go to the documentation of qr_mobile_vision 0.1.0 Download qr_mobile_vision 0.1.0 archive
0.0.7 Jul 24, 2018 Go to the documentation of qr_mobile_vision 0.0.7 Download qr_mobile_vision 0.0.7 archive
0.0.6 Jul 23, 2018 Go to the documentation of qr_mobile_vision 0.0.6 Download qr_mobile_vision 0.0.6 archive
0.0.5 Jul 19, 2018 Go to the documentation of qr_mobile_vision 0.0.5 Download qr_mobile_vision 0.0.5 archive
0.0.4 Jul 17, 2018 Go to the documentation of qr_mobile_vision 0.0.4 Download qr_mobile_vision 0.0.4 archive
0.0.3 Jul 17, 2018 Go to the documentation of qr_mobile_vision 0.0.3 Download qr_mobile_vision 0.0.3 archive
0.0.2 Jul 12, 2018 Go to the documentation of qr_mobile_vision 0.0.2 Download qr_mobile_vision 0.0.2 archive

All 11 versions...

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]
97
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/qr_camera.dart.

Run flutter format to format lib/qr_camera.dart.

Format lib/qr_mobile_vision.dart.

Run flutter format to format lib/qr_mobile_vision.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
native_device_orientation ^0.1.0 0.1.2
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8