Skip to content

yushulx/flutter_document_scan_sdk

Repository files navigation

Flutter Document Scan SDK

A Flutter wrapper for the Dynamsoft Capture Vision SDK, featuring document detection and normalization.

Flutter document scanner for Windows

Flutter document scanner normalization for Windows

Demo Video

  • iOS

    flutter-ios-document-scanner.mp4
  • Windows

    flutter-windows-document-scanner.mp4
  • Web

    flutter-web-document-scanner.mp4

Supported Platforms

  • ✅ Windows

  • ✅ Linux

  • ✅ Android

  • ✅ iOS

    • Add camera and microphone usage descriptions to ios/Runner/Info.plist:

      <key>NSCameraUsageDescription</key>
      <string>Can I use the camera please?</string>
      <key>NSMicrophoneUsageDescription</key>
      <string>Can I use the mic please?</string>
    • Minimum deployment target: iOS 13.0 or later

  • ✅ Web

    In index.html, include:

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dcv.bundle.min.js"></script>

Prerequisites

Getting Started

  1. Set the license key in example/lib/global.dart:

    Future<int> initDocumentSDK() async {
      int? ret = await docScanner.init(
          "LICENSE-KEY");
      ...
    }
  2. Run the example project on your desired platform:

    cd example
    flutter run -d chrome    # Run on Web
    flutter run -d linux     # Run on Linux
    flutter run -d windows   # Run on Windows
    flutter run              # Run on default connected device (e.g., Android)

API Reference

Method Description Parameters Return Type
Future<int?> init(String key) Initializes the SDK with a license key. key: License string Future<int?>
Future<NormalizedImage?> normalizeFile(String file, List<Offset> points, ColorMode color) Normalizes a document image from a file. file: Path to the image file
points: Document corner points
color: output image color
Future<NormalizedImage?>
Future<NormalizedImage?> normalizeBuffer(Uint8List bytes, int width, int height, int stride, int format, List<Offset> points, int rotation, ColorMode color) Normalizes a document image from a raw image buffer. bytes: Image buffer
width, height: Image dimensions
stride: Row stride in bytes
format: Image pixel format index
points: Document corner points
rotation: 0/90/180/270
color: output image color
Future<NormalizedImage?>
Future<List<DocumentResult>?> detectFile(String file) Detects documents in an image file. file: Path to the image file Future<List<DocumentResult>?>
Future<List<DocumentResult>?> detectBuffer(Uint8List bytes, int width, int height, int stride, int format, int rotation) Detects documents from a raw image buffer. bytes: Image buffer
width, height: Image dimensions
stride: Row stride in bytes
format: Image pixel format index
rotation: 0/90/180/270
Future<List<DocumentResult>?>