image_to_text_mlkit 1.0.6
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:
β
Camera
β
Gallery
β
Network URLs #
π· Extracting Text from Camera: #
![]() |
![]() |
![]() |
π Getting Started #
1. Add Dependency #
Add the following to your pubspec.yaml
:
dependencies:
image_to_text_mlkit: ^1.0.6
- Install Package Run the following command:
flutter pub get
- 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