document_capture 0.0.2
document_capture: ^0.0.2 copied to clipboard
DocuCapture is a Flutter package that provides a simple way to capture documents using a camera.
document_capture #
A Flutter package for scanning and capturing identity documents using the device camera.
Currently supports Kenya National ID cards (front and back), with planned support for passports and driver licenses.
โจ Features #
- ๐ Scan identity documents using camera
- ๐ฐ๐ช Kenya National ID support (Front & Back)
- ๐ท Real-time image capture
- ๐ Automatic document detection
- ๐งพ MRZ (Machine Readable Zone) data extraction (Back of ID)
- โก Lightweight and easy to integrate
๐ Getting started #
Add the package to your pubspec.yaml:
dependencies:
document_capture: ^0.0.2
Then run:
flutter pub get
๐ฆ Usage #
Import the package:
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:document_capture/widget/id_scan_button.dart';
import 'package:document_capture/mrz_parser/mrz_result.dart';
Example: Scanning ID (Front & Back) #
class IdScanExample extends StatefulWidget {
@override
State<IdScanExample> createState() => _IdScanExampleState();
}
class _IdScanExampleState extends State<IdScanExample> {
File? frontImage;
File? backImage;
File? faceImage;
MRZContent? mrzContent;
@override
Widget build(BuildContext context) {
return Column(
children: [
// Scan Front of ID
IdFrontScanButton(
onCompleted: (result) {
setState(() {
frontImage = result['captureImage'] as File;
faceImage = result['faceImage'] as File?;
});
},
child: const Text('Scan Front of ID'),
),
const SizedBox(height: 20),
// Scan Back of ID
IdBackScanButton(
onCompleted: (result) {
setState(() {
backImage = result['fileImage'] as File;
mrzContent = result['mrzContent'] as MRZContent;
});
},
child: const Text('Scan Back of ID'),
),
const SizedBox(height: 20),
// Display extracted data
if (mrzContent != null) ...[
Text('Full Name: ${mrzContent!.fullNames}'),
Text('ID Number: ${mrzContent!.personalNumber2}'),
Text('Date of Birth: ${mrzContent!.birthDate}'),
Text('Gender: ${mrzContent!.sex}'),
],
],
);
}
}
๐ Supported Documents #
| Document Type | Status |
|---|---|
| Kenya National ID | โ Supported |
| Passport | ๐ง Planned |
| Driver License | ๐ง Planned |
๐ Use cases #
- KYC (Know Your Customer)
- Fintech onboarding
- Identity verification systems
- Insurance and government applications
โ ๏ธ Requirements #
- Camera permission required
- Works on Android and iOS
โ ๏ธ Limitations #
- Currently supports only Kenya National ID
- Other document types are planned but not yet implemented
๐ฎ Roadmap #
- Passport scanning support
- Driver license scanning
- Multi-country document support
- Improved OCR and data extraction
๐ค Contributions #
Contributions are welcome! Feel free to open issues or submit pull requests.
๐ License #
MIT License