edge_detection_scan 0.0.1 copy "edge_detection_scan: ^0.0.1" to clipboard
edge_detection_scan: ^0.0.1 copied to clipboard

A cross-platform Flutter plugin that provides native document scanning with automatic edge detection, returning high-quality scanned image paths from both Android and iOS.

edge_detection_scan #

A cross-platform Flutter plugin that provides native document scanning with automatic edge detection, returning high-quality scanned image paths from both Android and iOS.

โœ… Platform Support #

  • Android: Uses Google ML Kit with Camera & File Storage
  • iOS: Uses VNDocumentCameraViewController via Apple VisionKit

Ideal for OCR workflows, document digitization, and PDF generation without OpenCV dependencies.


โœจ Features #

  • Native document scanning UI
  • Automatic edge detection
  • Returns image file path
  • Lightweight and easy to use
  • Fully extendable for OCR and PDF output

๐Ÿ“ฆ Installation #

Add the package in your pubspec.yaml:

dependencies:
  edge_detection_scan:
    git:
      url: https://github.com/git-rns/edge_detection_scan.git

Replace the URL with your pub.dev link once published.


๐Ÿ›  Platform Configuration #

๐Ÿ”น Android #

1. Required Permissions

Add these permissions to android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

๐Ÿ”น iOS #

  • Minimum deployment target: iOS 14.0+

1. Info.plist Settings

In ios/Runner/Info.plist, add:

<key>NSCameraUsageDescription</key>
<string>This app requires camera access to scan documents.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app needs photo library access to save scanned documents.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to view saved scans in your gallery.</string>

2. Podfile Target

Update your ios/Podfile:

platform :ios, '14.0'

Then run:

cd ios && pod install

๐Ÿ’ป Usage #

import 'package:edge_detection_scan/edge_detection_scan.dart';

Future<void> scanDocument() async {
  final imagePath = await EdgeDetectionScan.scanDocument();
  if (imagePath != null) {
    print('Scanned image saved at: $imagePath');
  }
}

๐Ÿ“ธ Output #

Returns a local file path (String) to the scanned image:

  • Display with Image.file(File(imagePath))
  • Pass to OCR or ML models
  • Convert to PDF

๐Ÿงช Example #

ElevatedButton(
  onPressed: () async {
    final result = await EdgeDetectionScan.scanDocument();
    if (result != null) {
      showDialog(
        context: context,
        builder: (_) => Image.file(File(result)),
      );
    }
  },
  child: Text("Scan Document"),
)

๐Ÿงฉ How It Works #

  • Android: Captures an image using the native camera and stores it using FileProvider. ML Kit can be integrated for auto-cropping.
  • iOS: Uses Apple's VisionKit to present a full document scanning interface with built-in edge detection.

๐Ÿ“ƒ License #

MIT ยฉ RNS


๐Ÿ’ฌ Feedback or Contributions? #

We welcome your issues and PRs!
๐Ÿ‘‰ GitHub Repository

5
likes
160
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

A cross-platform Flutter plugin that provides native document scanning with automatic edge detection, returning high-quality scanned image paths from both Android and iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on edge_detection_scan

Packages that implement edge_detection_scan