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
- Host: GitHub
- URL: https://github.com/yushulx/flutter_document_scan_sdk
- Owner: yushulx
- License: mit
- Archived: true
- Created: 2022-11-24T07:34:42.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-09T08:38:10.000Z (about 1 year ago)
- Last Synced: 2025-03-06T06:46:39.416Z (8 months ago)
- Topics: dart, document-detection, document-rectification, flutter
- Language: C++
- Homepage: https://pub.dev/packages/flutter_document_scan_sdk
- Size: 32.1 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter Document Scan SDK
A Flutter wrapper for the **Dynamsoft Capture Vision SDK**, featuring document detection and normalization.


## 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?>` |