flutter_mobile_vision 0.1.3

flutter_mobile_vision #

Codacy Badge pub package

Flutter implementation for Google Mobile Vision.

Based on Google Mobile Vision.

Android Samples -=- iOS Samples

Liked? ⭐ Star the repo to support the project!

Features #

  • [x] Android

    • [x] Barcode Scan
      • [x] Front or Back camera.
      • [x] Select preview sizes.
      • [x] Simple scan.
      • [x] Toggle torch.
      • [x] Toggle auto focus.
      • [x] Specify types of barcodes that will be read.
      • [x] Tap to capture.
      • [x] Select barcode type to be scanned.
      • [x] Scan multiple barcodes.
      • [x] Barcode coordinates.
      • [x] Show barcode text.
      • [x] Standard code.
    • [x] Recognize Text
      • [x] Front or Back camera.
      • [x] Select preview sizes.
      • [x] Simple OCR.
      • [x] Toggle torch.
      • [x] Toggle auto focus.
      • [x] Multiple recognition.
      • [x] Text language.
      • [x] Text coordinates.
      • [x] Hide recognized text.
      • [x] Standard code.
    • [x] Detect Faces
      • [x] Front or Back camera.
      • [x] Select preview sizes.
      • [x] Simple detection.
      • [x] Toggle torch.
      • [x] Toggle auto focus.
      • [x] Multiple detection.
      • [x] Face coordinates.
      • [x] Hide detection information.
      • [x] Standard code.
    • [x] Generalization of capture activities.
    • [x] Choose between back and front camera.
    • [x] Control camera FPS.
  • [ ] iOS

    • [ ] Barcode Scan
      • [ ] Future Tasks
    • [ ] Recognize Text
      • [ ] Future Tasks
    • [ ] Detect Faces
      • [ ] Future Tasks

Your feature isn't listed? Open a issue right now! #

Screenshots #

Usage #

Example

To use this plugin :

  • add the dependency to your pubspec.yaml file:
  dependencies:
    flutter:
      sdk: flutter
    flutter_mobile_vision: ^0.1.3
  • add FlutterMobileVision.start() to initState():
@override
void initState() {
  super.initState();
  FlutterMobileVision.start().then((x) => setState(() {}));
}

or for a better implementation:

@override
void initState() {
  super.initState();
  FlutterMobileVision.start().then((previewSizes) => setState(() {
    _previewBarcode = previewSizes[_cameraBarcode].first;
    _previewOcr = previewSizes[_cameraOcr].first;
    _previewFace = previewSizes[_cameraFace].first;
  }));
}

Barcode #

//...
List<Barcode> barcodes = [];
try {
  barcodes = await FlutterMobileVision.scan(
    flash: _torchBarcode,
    autoFocus: _autoFocusBarcode,
    formats: _onlyFormatBarcode,
    multiple: _multipleBarcode,
    waitTap: _waitTapBarcode,
    showText: _showTextBarcode,
    preview: _previewBarcode,
    camera: _cameraBarcode,
    fps: 15.0,
  );
} on Exception {
  barcodes.add(new Barcode('Failed to get barcode.'));
}
//...

Android #

For Android, you must do the following before you can use the plugin:

  • Add the camera permission to your AndroidManifest.xml

    <uses-feature android:name="android.hardware.camera" />

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

  • Add the Barcode activity to your AndroidManifest.xml (after other activity nodes)

    <activity android:name="io.github.edufolly.fluttermobilevision.barcode.BarcodeCaptureActivity" />

iOS #

If you can help, the community thanks. Your fork is needed. 😉


OCR #

//...
List<OcrText> texts = [];
try {
  texts = await FlutterMobileVision.read(
    flash: _torchOcr,
    autoFocus: _autoFocusOcr,
    multiple: _multipleOcr,
    showText: _showTextOcr,
    previewSize: _previewOcr,
    preview: _previewOcr,
    camera: _cameraOcr,
    fps: 2.0,
  );
} on Exception {
  texts.add(new OcrText('Failed to recognize text.'));
}
//...

Android #

For Android, you must do the following before you can use the plugin:

  • Add the camera permission to your AndroidManifest.xml

    <uses-feature android:name="android.hardware.camera" />

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

  • Add the OCR activity to your AndroidManifest.xml (after other activity nodes)

    <activity android:name="io.github.edufolly.fluttermobilevision.ocr.OcrCaptureActivity" />

iOS #

If you can help, the community thanks. Your fork is needed. 😉


Face Detection #

//...
List<Face> faces = [];
try {
  faces = await FlutterMobileVision.face(
    flash: _torchFace,
    autoFocus: _autoFocusFace,
    multiple: _multipleFace,
    showText: _showTextFace,
    preview: _previewFace,
    camera: _cameraFace,
    fps: 15.0,
  );
} on Exception {
  faces.add(new Face(-1));
}
//...

Android #

For Android, you must do the following before you can use the plugin:

  • Add the camera permission to your AndroidManifest.xml

    <uses-feature android:name="android.hardware.camera" />

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

  • Add the Face Detection activity to your AndroidManifest.xml (after other activity nodes)

    <activity android:name="io.github.edufolly.fluttermobilevision.face.FaceCaptureActivity" />

iOS #

If you can help, the community thanks. Your fork is needed. 😉

[0.1.3] - 2018-12-23

  • Improvements to get camera permission.

[0.1.2] - 2018-12-16

  • Camera preview size implementation. Important!! FlutterMobileVision.start()

[0.1.1] - 2018-07-08

  • Bug fixed - Crash when the permission is not granted on Android #7

[0.1.0] - 2018-05-06

  • Production mode on.

[0.0.4] - 2018-05-04

  • Face Detection.

[0.0.3] - 2018-05-02

  • Text Recognition.
  • Improvements.

[0.0.2] - 2018-04-23

  • Multiple Scans.
  • And a lot of new features.

[0.0.1] - 2018-04-22

  • Basic test functions.
  • Only Scan Barcodes.
  • Only Android support.

example/README.md

flutter_mobile_vision_example #

Demonstrates how to use the flutter_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:
  flutter_mobile_vision: ^0.1.3

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:flutter_mobile_vision/flutter_mobile_vision.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
85
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

82 out of 82 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-a <3.0.0
flutter 0.0.0
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

Admin