document_scanner 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 66

flutter_document_scanner #

A plugin for Flutter apps that adds document scanning functionality on Android.

Getting Started #

TBD

How to use ? #

first add as a dependency in pubspec.yaml

import:

import 'package:document_scanner/document_scanner.dart';

then use it as a widget:

DocumentScanner(
    onPictureTaken: (String image) {
        print("document : " + image);
    },
                          
)

License #

This project is licensed under the MIT License - see the LICENSE.md file for details

0.0.1 #

  • inital alfa release
  • needs testing for android

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:document_scanner/document_scanner.dart';

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  String imageLocation;
  bool enableTorch;
  @override
  void initState() {
    enableTorch = false;
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        floatingActionButton: FloatingActionButton(
            child: Icon(!enableTorch ? Icons.flash_on : Icons.flash_off),
            onPressed: () {
              setState(() {
                enableTorch = !enableTorch;
              });
            }),
        body: Stack(
          children: <Widget>[
            Column(
              children: <Widget>[
                Expanded(
                  child: imageLocation != null
                      ? Image(
                          image:
                              FileImage(File.fromUri(Uri.file(imageLocation))))
                      : DocumentScanner(
                          onPictureTaken: (String image) {
                            print("document : " + image);

                            setState(() {
                              imageLocation = image.replaceRange(0, 7, "");
                              // imageLocation = image;
                            });

                            print("document : " + imageLocation);
                          },
                          brightness: 5,
                          contrast: 1.3,
                          enableTorch: enableTorch,
                        ),
                ),
              ],
            ),
            imageLocation != null
                ? Positioned(
                    bottom: 20,
                    left: 0,
                    right: 0,
                    child: RaisedButton(
                        child: Text("retry"),
                        onPressed: () {
                          setState(() {
                            imageLocation = null;
                          });
                        }),
                  )
                : Container(),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  document_scanner: ^0.0.1

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

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:document_scanner/document_scanner.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:document_scanner/document_scanner.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:document_scanner/document_scanner.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:document_scanner/document_scanner.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • document_scanner that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.49 points)

57 out of 58 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.

Fix lib/document_scanner.dart. (-1.49 points)

Analysis of lib/document_scanner.dart reported 3 hints:

line 1 col 8: Unused import: 'dart:async'.

line 3 col 8: Unused import: 'package:document_scanner/scannedImage.dart'.

line 55 col 41: This function has a return type of 'Future

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/eliasteeny/flutter_document_scanner was unreachable.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test