emirates_id_scanner 0.0.3 emirates_id_scanner: ^0.0.3 copied to clipboard
A package for swift and accurate scanning and data extraction from Emirates ID cards.
Emirates ID Scanner #
The emirates_id_scanner
package provides a seamless and efficient way to scan and extract data from Emirates ID cards using Google ML Kit. This package is designed to simplify the process of ID scanning in applications, making it a valuable tool for any app that requires data extraction.
Features #
-
Camera Overlay Preview: Includes a built-in camera overlay that helps users capture the ID card image accurately. The overlay guides the user to position the ID card correctly, ensuring optimal image capture for data extraction.
-
ID Section Cropping: After capturing the image, the package automatically crops the relevant ID section, focusing on the critical data areas of the Emirates ID card.
-
Data Extraction and Processing: Utilizes advanced Google Machine Learning OCR technology to scan and extract data from the ID card. The extracted data is then processed and returned as a structured model, making it easy to integrate into your application.
-
Customizable Workflow: Offers flexibility in its implementation, allowing you to customize the scanning and data extraction flow to suit your app's specific needs and user experience requirements.
Getting Started #
To start using emirates_id_scanner
, add it to your Flutter project by including it in your pubspec.yaml
file. Ensure you have camera permissions set up in your app as this package requires camera access for ID scanning.
Usage #
To integrate the emirates_id_scanner
into your Flutter application, follow this example. This demonstrates how to set up a camera overlay for scanning Emirates ID cards, capture an image, and then use the EIDScanner
to scan and extract data from the ID.
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:emirates_id_scanner/camera_overlay/camera_overlay.dart';
import 'package:emirates_id_scanner/camera_overlay/overlay_model.dart';
import 'package:emirates_id_scanner/eid_scanner/eid_scanner.dart';
import 'package:emirates_id_scanner/eid_scanner/emirate_id_model.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_ml_kit_example/controllers/general_controller.dart';
class EidScreen extends GetView<GeneralController> {
const EidScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white
),
backgroundColor: Colors.white,
body: FutureBuilder<List<CameraDescription>>(
future: availableCameras(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasData && snapshot.data != null) {
return CameraOverlay(
onCapture: (XFile file) async {
final EmirateIdModel? extractedText =
await EIDScanner.scanEmirateID(image: File(file.path));
// Process the extracted data
print(extractedText);
},
model: CardOverlay.byFormat(),
camera: snapshot.data!.first,
);
} else {
return const Align(
alignment: Alignment.center,
child: Text(
'No camera found',
style: TextStyle(color: Colors.black),
));
}
},
),
);
}
}