An open API service indexing awesome lists of open source software.

https://github.com/yushulx/flutter_document_scan_sdk

A Flutter Document Detection SDK built with Dynamsoft Document Normalizer
https://github.com/yushulx/flutter_document_scan_sdk

dart document-detection document-rectification flutter

Last synced: about 1 month ago
JSON representation

A Flutter Document Detection SDK built with Dynamsoft Document Normalizer

Awesome Lists containing this project

README

          

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

![Flutter document scanner for Windows](https://www.dynamsoft.com/codepool/img/2025/05/flutter-document-scanner-windows.png)

![Flutter document scanner normalization for Windows](https://www.dynamsoft.com/codepool/img/2025/05/flutter-document-scanner-normalization-windows.png)

## Demo Video
- iOS

https://github.com/user-attachments/assets/d6f44994-ea37-4f72-8079-6492f52547d2

- Windows

https://github.com/user-attachments/assets/89113ad1-7699-49a7-ade0-81949cc8ced6

- Web

https://github.com/user-attachments/assets/3e51915b-c7ad-4406-8ef1-e5cb12fee806

## Supported Platforms
- ✅ Windows
- ✅ Linux
- ✅ Android
- ✅ iOS

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

```xml
NSCameraUsageDescription
Can I use the camera please?
NSMicrophoneUsageDescription
Can I use the mic please?
```

- Minimum deployment target: iOS 13.0 or later

- ✅ Web

In `index.html`, include:

```html

```

## Prerequisites
- A valid [Dynamsoft Capture Vision license key](https://www.dynamsoft.com/customer/license/trialLicense/?product=dcv&package=cross-platform)

## Getting Started
1. Set the license key in `example/lib/global.dart`:

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

```bash
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 init(String key)` | Initializes the SDK with a license key. | `key`: License string | `Future` |
| `Future normalizeFile(String file, List 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` |
| `Future normalizeBuffer(Uint8List bytes, int width, int height, int stride, int format, List 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` |
| `Future?> detectFile(String file)` | Detects documents in an image file. | `file`: Path to the image file | `Future?>` |
| `Future?> 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?>` |