image_to_text_mlkit 1.0.6 copy "image_to_text_mlkit: ^1.0.6" to clipboard
image_to_text_mlkit: ^1.0.6 copied to clipboard

A Flutter package to convert images to text using Google MLKit with support for gallery, camera, and network URLs

Here’s the complete and polished README.md:

πŸ“Έ Image to Text MLKit #

A Flutter package that converts images to text using Google ML Kit. It supports extracting text from:

πŸ“· Extracting Text from Camera: #

πŸš€ Getting Started #

1. Add Dependency #

Add the following to your pubspec.yaml:

dependencies:
  image_to_text_mlkit: ^1.0.6
  1. Install Package Run the following command:

flutter pub get

  1. Import the Package
import 'package:image_to_text_mlkit/image_to_text_mlkit.dart';

πŸ“– Usage πŸ–ΌοΈ Pick Image from Gallery

final imageToText = ImageToTextMLKit();
String? text = await imageToText.pickImageFromGallery();
print(text);

πŸ“Έ Capture Image from Camera

String? textFromCamera = await imageToText.pickImageFromCamera();
print(textFromCamera);

🌐 Process Image from URL

String url = 'https://example.com/sample-image.jpg';
String? textFromUrl = await imageToText.processNetworkImage(url);
print(textFromUrl);

βš™οΈ Permissions 🟒 Android Permissions

Add the following permissions in android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
    android:requestLegacyExternalStorage="true"
    android:networkSecurityConfig="@xml/network_security_config"
    ...

Add the following permissions in /android/app/src/main/res/xml/network_security_config.xml if you dont have create one file and add below code in xml/network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">images.template.net</domain>
    </domain-config>
</network-security-config>

Add the following permissions in android/app/build.gradle:

android {
    compileSdkVersion 34 // Or latest
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 34
    }
}

🍎 iOS Permissions

Add the following keys to your ios/Runner/Info.plist file:

<key>NSCameraUsageDescription</key>
<string>We need camera access to capture and process images.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>We need access to your photo library to select and process images.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>We need access to save processed images to your library.</string>

πŸ“Έ Developed by #

βœ… VENU RENANGI
βœ… SONAM GUPTA βœ… KAMNA JOSHI

9
likes
160
points
78
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to convert images to text using Google MLKit with support for gallery, camera, and network URLs

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_ml_kit, google_mlkit_text_recognition, http, image_picker, path_provider

More

Packages that depend on image_to_text_mlkit