• Courses
  • YouTube
  • Dev News
  • Technology
  • Blogs
  • Flutter Jobs
  • Contact
    • About Us
    • RegisterLogin
    Navoki
    • Courses
    • YouTube
    • Dev News
    • Technology
    • Blogs
    • Flutter Jobs
    • Contact
      • About Us
    • RegisterLogin

      Developers

      • Home
      • Blog
      • Developers
      • Detect Barcode using Firebase ML kit
      FirebaseBarcodeReader 700x400

      Detect Barcode using Firebase ML kit

      • Posted by Shivam Srivastava
      • Categories Developers, Flutter
      • Date March 17, 2020

      Introduction

      So, I know Machine Learning is there in open and it’s been there for quite long. It goes means back in the previous century once it had been initially coined and brought into existence, currently, you discover it every place in existence therefore vital that your life is perhaps enclosed by it and you will even not understand, consider your smartphones they’re referred to as “smart” for a specific reason and nowadays they’re “smartest” while getting even more n more from day to day, as a result of they’re learning regarding you from you itself the additional you’re using it the more your smartphone gets to grasp you and every one of that’s simply the machine with lines of code evolving with time like humans. It’s not simply restricted to smartphones, it’s in-depth in technology.

      Purpose of this article?

      Nowadays every developer familiar with the term Machine Learning In this article, today we create a simple barcode reader application using Flutter and Firebase ML kit, also I explain all the steps in a simple manner so anybody can use the Firebase ML kit in a flutter project.

      Setup Flutter SDK

      If you don’t have a flutter set up in your machine so you have to need to install it first. Click here to learn how to set up flutter on Windows and for Linux click here.

      Create a Firebase Project

      For use firebase properties you have to need to register your app in firebase. First, integrate your flutter project to firebase, if you don’t know how to do it, read my Flutter Firebase Integration article.

      Let’s Begin for the code.

      • Add firebase_ml_vision and image_picker dependency in your project pubspec.yaml file.
      dependencies:
        flutter:
          sdk: flutter
        firebase_ml_vision: <latest_version>
        image_picker: <latest_version>

      firebase_ml_vision: This dependency used for access Firebase ML kit.
      image_picker: This dependency used to get a barcode image.

      Run flutter packages get command on terminal

      • Add the below code in your main.dart file for import dependency.
      import 'package:image_picker/image_picker.dart';
      import 'package:firebase_ml_vision/firebase_ml_vision.dart';

      Now we are ready for Coding the component.

      Now we are ready to code the components, as in the below code I am taking barcode image from the gallery you can get from the camera also as you need, after getting the image we store all the barcodes in Barcode List and then print all the barcodes using a loop, you can perform any other task instead of print.

        Future<void> getBarcodeImage() async {
          var image = await ImagePicker.pickImage(source: ImageSource.gallery);
      
          final FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(image);
          final BarcodeDetector barcodeDetector = FirebaseVision.instance.barcodeDetector();
          final List<Barcode> barcodes = await barcodeDetector.detectInImage(visionImage);
      
          for(int i=0;i<barcodes.length;i++)
          {
            String getBarcode=barcodes[i].rawValue;
            print(getBarcode);
          }
        }

      Now call this function in your flutter application the same as calling other functions.

      done2 | Detect Barcode using Firebase ML kit

      Get complete code click here.

      Bookmark(0)

      Please login to bookmark

      Continue with Google
      Continue with Facebook
      0

      Tag:barcode detection api, barcode scanner, firebase barcode scanner, firebase vision barcode, ml kit vision barcode, qr scanner using firebase android

      • Share:
      Shivam Srivastava
      Shivam Srivastava

      Mobile Solution [email protected], Android and Flutter Dev, Dart ,Founder of @Navoki, Instructor

      Previous post

      DATE TIME PICKER DIALOG USING FLUTTER
      March 17, 2020

      Next post

      Objects Detection From Image Using Flutter
      March 21, 2020

      You may also like

      whats-new-in-flutter-2.0.0
      Flutter 2 is here | What’s new in Flutter 2.0.0
      22 March, 2021
      Flutter Commands a Developer must know, Cheat Sheet
      14 Flutter Commands a Developer must know, Cheat Sheet
      28 January, 2021
      6 Things About HTTP Request in Dart For Beginners-min
      6 Things About HTTP Request in Dart For Beginners
      7 September, 2020


      Categories

      • Android
      • Dart
      • Developers
      • Flutter
      • Flutter Desktop
      • Flutter Mobile
      • Flutter Web
      • Fuchsia
      • Go Lang
      • Technology
      • Uncategorized

      Recent Post

      • whats-new-in-flutter-2.0.0Flutter 2 is here | What’s new in Flutter 2.0.0
      • Flutter Commands a Developer must know, Cheat Sheet14 Flutter Commands a Developer must know, Cheat Sheet
      • 6 Things About HTTP Request in Dart For Beginners min | 6 Things About HTTP Request in Dart For Beginners6 Things About HTTP Request in Dart For Beginners

      Subscribe Now

       

      Social Connect

      Recent Courses

      Flutter App Development Course Online

      Flutter App Development Course Online

      Single and Multi Selection ListView in Flutter

      Single and Multi Selection ListView in Flutter

      Go Installation and Variables

      Go Installation and Variables

      List in Dart Programming language

      List in Dart Programming language

      View All

      DON’T MISS A BEAT

      Be the first to know when our album is released on iTunes and Spotify

      We don’t spam! Read our privacy policy for more info.

      Check your inbox or spam folder to confirm your subscription.

      Contact

      •   [email protected]
      •   Navoki Technologies Pvt. Ltd.
        JMD Megapolis , Sector 48, Gurugram, Haryana 122018

      Company

      • About Us
      • Blogs
      • Contact
      • Privacy policy
      • Terms & Condition

      Useful Links

      • Courses
      • Youtube
      • Dev News

      Mobile

      Click and Get started in seconds

      "Navoki" is a registered trademark of Navoki.com ® 2020–2030 Navoki Technologies Pvt Ltd.

      • Terms & Condition

      Login with your site account

      Continue with Google
      Continue with Facebook

      By "Sign in” above to accept Navoki’s Terms of Service & Privacy Policy.

      Not a member yet? Register now

      Register a new account

      Continue with Google
      Continue with Facebook

      By "Sign Up” above to accept Navoki’s Terms of Service & Privacy Policy.

      Are you a member? Login now