Web Document Scanner

PubVersion PubPoints build Star on Github Latest Dartdocs

ios

A Flutter Package to Scan Document on WEB.

Contents:

Getting Started

Add dependencies in the pubspec.yaml:

dependencies:
  web_document_scanner: ^latest

Get the Changes by:

flutter pub get

or

dart pub get

Usage

import 'package:web_document_scanner/web_document_scanner.dart';

Controller must be initialized:

  void _controllerInitialization() async {
  scannerStatus = ScannerStatus.initializing;
  final List<CameraDescription> cameras = await availableCameras();
  if (cameras.isNotEmpty) {
    final CameraDescription selectedCamera = cameras.first;
    scannerController = ScannerController(description: selectedCamera);
    if (scannerController != null) {
      await scannerController?.initialize();
    } else {
      throw Exception(PackageStrings.throwErrorControllerInitialization);
    }
  } else {
    throw Exception(PackageStrings.throwErrorCameraAvailability);
  }
}

Controller Can be Initialized in page initialization OR triggered by a trigger such as tapping on a Button:

  void onInit() {
  _controllerInitialization();
  super.initState();
}

OR

Button(onPressed: () => _controllerInitialization(), child: Text('Controller Initialization'));

NOTE: In either way, Controller must be initialized before having Scanner Widget.

Using Scanner Widget in your Screen:

WebDocumentScanner(scannerController!);

Controller will return the Captured Document:

ScannerResponse scannerResponse = await scannerController!.startAutoScan();

The Status of the Scanner can be controlled by setting the ScannerStatus of the Controller:

ScannerStatus scannerStatus = ScannerStatus.scanning;

You can check the /example for a more complete example, more details and further information.

Docs

build

About Author

Resam Taghipour

Pub account Pub Pub

Packages and Dependencies

Pub Pub Pub Pub Pub

License

This project is licensed under the 'BSD-3-Clause' License - see the LICENSE for details.

Pub

Libraries

web_document_scanner
Extensions Boiler Plate