ReadIt is a Flutter-based application that uses Optical Character Recognition (OCR) to extract text from images. This app utilizes the google_mlkit_text_recognition
package to process images and recognize text in real-time. The app is designed with a clean architecture and follows the MVVM design pattern to maintain a modular, scalable, and testable structure.
The project follows the separation-of-concerns principle, which divides the app into two primary layers:
- Views: Responsible for rendering UI elements. Views are composed of widgets and are passed data from the ViewModel.
- ViewModels: Contains the logic to transform data into a format suitable for the UI. They manage the UI state and handle user interactions.
- Repositories: Source of truth for the app data, which interacts with services to fetch and process the data.
- Services: Wrap API endpoints and other external data sources, such as platform plugins or REST APIs, to provide the data needed by the repositories.
- Image Selection: Select images from the gallery using
image_picker
. - Image Cropping: Crop images before processing with
image_cropper
. - OCR Text Extraction: Use
google_mlkit_text_recognition
to extract text from images. - Text Display: Display the extracted text in a clear format on the UI.
The app is built using the MVVM (Model-View-ViewModel) design pattern:
- Model: Data layer consisting of Repositories and Services that fetch and process the data.
- View: UI layer responsible for presenting data and user interaction.
- ViewModel: Acts as a mediator between the View and Model, transforming data into a suitable format for presentation.
- Views: Represent screens and UI components (e.g., HomePage, CameraScreen, GalleryScreen, etc.). They display the extracted text and accept user input.
- ViewModels: Handle the core logic of text extraction and interaction with repositories. Each screen will have its own ViewModel, ensuring separation of concerns.
- Repositories: Responsible for managing the app's data, such as fetching and processing images, and extracting text using the OCR model.
- Services: Provide access to external APIs or platform services, like Google’s ML Kit OCR.
To get started with the app, clone the repository and install dependencies.
- Flutter SDK (version 3.5.4 or higher)
- Dart SDK
-
Clone the repository:
git clone https://github.com/yourusername/readit.git cd readit
-
Install dependencies:
flutter pub get
-
Run the app:
flutter run
- image_picker: Allows users to select images from their gallery.
- image_cropper: Enables image cropping before processing.
- google_mlkit_text_recognition: Uses Google’s ML Kit to extract text from images using OCR.
- google_fonts: Provides a selection of fonts for the app UI.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.