Firebase ML-KIT In Flutter


Before starting the blog topic Firebase ML-KIT In Flutter, let’s discuss ML-KIT of the firebase. Machine-Learning Kit is a mobile SDK that brings machine-learning expertise to native as well as hybrid apps. ML-KIT  comes with predefined ready-to-use APIs, that can be used by anyone who did not have deep knowledge of machine learning.

With the help of Firebase ML-KIT, we can perform various operations that can enhance or beautify the overall experience of the application.  In this blog, we will discuss text recognition from an image with the help of Firebase ML-KIT In Flutter. Let’s explore, how we can implement the ML-KIT in Flutter with mentioned steps.

You can also explore our Flutter app development company page.

1. Registration of the App

First of all, we need to register our app on the Firebase console for accessing the Firebase ML-KIT, we can follow the mentioned URL for registering the app on the Firebase console.

Firebase Console

2. Adding Firebase ML-VISION Package

Now we will add the ml-vision package in our pubspec.yaml folder inside our flutter project.  I have added the following package, you can also add the updated version.

3  Adding package for Image

Now, according to our use case, we can use multiple types of packages for getting the image. In our demo, we have used an image from the camera and gallery both.

For accessing the camera, we have used the following package :

But after clicking the image from the camera, we need to save the image inside the directory of the app and we need the path of the image for creating the file. So we have also used the following packages.

For accessing the gallery, we have used the image picker package:

Note: Please do not forget to add the firebase dependency to the android app build.Gradle file

4. Now, we can proceed with our main functionality of the blog i.e., Recognition of text from the image

>> Declare the CameraDescription list for accessing all available cameras of the devices.

Note: Please add this code inside the try-catch block for exception handling.

>> Initialised the Camera controller for making camera design

>> Now, we will click the image and save it to the internal storage, then we can use it for image processing.

We have used the random number to save the images inside the directory with new names each and every time we click the image. We can also use the image picker to select the image from the gallery:

After getting the image, now we can recognize the app and extract the text.

>> Here is the output app result of our app:

.                                                     o/p     

This is a basic example of text recognization through ML-KIT. You can perform multiple operations through Firebase ML-KIT.

Hope this blog helps you to use Firebase ML-KIT In Flutter.

For more information, please go through the Flutter and Firebase console docs.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

Markus Walter

Markus Walter

Founder, Das Apartment Living

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home