A Flutter plugin that enables text detection from specific areas of an image or live camera preview. Just drag/select the area you want to scan, and let it extract the text using ML Kit.
Perfect for scanning:
🧾 Receipts image
📄 Documents image
📘 PDFs image
🧠 Custom fields in images
🚀 Features
📸 Supports both live camera and gallery image input
✍️ Manual area selection (drag, resize, pan, freeze)
final pickedFile = awaitImagePicker().pickImage(source: ImageSource.gallery);
✨ Example Usage
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SelectImageAreaTextDetect(
detectOnce: true, // Set to false for continuous scan
enableImageInteractions: true,
imagePath: pickedFile?.path ?? '',
onDetectText: (value) {
if (value isString) {
print("Detected: $value");
} elseif (value isList<String>) {
for (int i = 0; i < value.length; i++) {
print("${i + 1}. ${value[i]}");
}
}
},
onDetectError: (error) {
if (error isPlatformException &&
(error.message?.contains("InputImage width and height should be at least 32!") ?? false)) {
ScaffoldMessenger.of(context).showSnackBar(
constSnackBar(content: Text("Selected area must be at least 32x32 pixels.")),
);
}
},
),
),
);
<key>NSCameraUsageDescription</key><string>Need camera access for live scanning</string><key>NSPhotoLibraryUsageDescription</key><string>Need photo access to pick images</string>