Blog - Barcode & QR Code Scanning in Flutter Apps (flutter_scanner_devxhub) By DEVxHUB

Barcode & QR Code Scanning in Flutter Apps (flutter_scanner_devxhub) By DEVxHUB

App Development

Jan 23, 2024

By Biplob Hossen

In the ever-evolving world of app development, staying ahead means integrating the latest functionalities that enhance user experience. For Flutter developers, the flutter_scanner_devxhub by DEVxHUB is a game changer. This plugin brings the power of barcode scanning to your Flutter apps, supporting both Android and iOS platforms with ease.

Changing the Game in App Development with flutter_scanner_devxhub:

In our continuous effort to enhance mobile app development, DEVxHUB is thrilled to announce the release of our newest Flutter plugin: flutter_scanner_devxhub.

This cool tool makes scanning easy in your Flutter apps, giving you a more fun and user-friendly experience.

What is flutter_scanner_devxhub?

Flutter Scanner DEVxHUB is a super useful tool on that makes scanning easy. It's made with the latest tech, letting Flutter developers add scanning features like reading documents and QR codes to their apps effortlessly.

Key Features and Benefits:

Our plugin stands out with several key features, making it an essential tool for developers:

  1. Versatility in Scanning: Whether it’s QR codes, barcodes, or documents, our plugin can handle various formats with ease.
  2. High Performance: Optimized for speed and accuracy, flutter_scanner_devxhub ensures a smooth scanning experience.
  3. Easy Integration: With simple and well-documented steps, integrating the plugin into your existing Flutter project is hassle free.
  4. Cross-Platform Compatibility: True to Flutter's philosophy, our plugin works seamlessly across iOS and Android.
  5. Customizable UI: Developers can customize the scanning interface to match their app’s look and feel.

Getting Started Is a Breeze

**Setting Up**: The process begins with a simple download or clone of the repository. Launch your project in Android Studio or VS Code, navigate to `pubspec.yaml`, and activate the packages. For iOS, a little extra step is needed: open the project in Xcode, perform a `pod install` in the `example/ios` directory, and then run it from Xcode.

Platform-Specific Instructions

Android Instructions:

- Switch to using `FlutterFragmentActivity` instead of `FlutterActivity` in your `MainActivity.kt`.

iOS Instructions - Swift Support Required:

For New Projects:

1. Create a new Flutter project, ensuring you include Swift support.

2. Open the iOS project in Xcode.

3. Set the minimum deployment target to 12 and Swift version to 5.

4. Close Xcode and run `pod install` in the `/ios` directory of your Flutter project.

For Existing Projects:

- If your project is already using Swift

 - Set the minimum deployment target to 12 and Swift version to 5, then run `pod install` in `/ios`.

- If your project uses Objective-C

 - Create a new Flutter project with the same name (including Swift support) at a different location.

 - Replace the existing `/ios` folder with the new one.

 - Open in Xcode, set the deployment target to 12, and Swift version to 5, followed by `pod install` in `/ios`.

 - Note: Remember to reapply any previous iOS-specific changes.

Implementing the Scanner in Your App

To utilize this feature on iOS, add a camera usage description in `Info.plist`:

<string>Camera permission is required for barcode scanning.</string>

Next, include `flutter_scanner_devxhub` in your `pubspec.yaml` dependencies:

 flutter_scanner_devxhub: ^1.0.1

Import the package in your Dart file:

import 'package:flutter_scanner_devxhub/flutter_scanner_devxhub.dart';

Then, implement the `scanBarcode` method:

String barcodeScanRes = await FlutterScanner.scanBarcode(
 lineColor: '#ff6666',
 cancelButtonText: 'Cancel',
 isShowFlashIcon: true,
 scanMode: ScanMode.QR,
 iconSize: 50,
 fontSize: 20,
 flashIconPath: "assets/flash.png",
 flashOffIconPath: "assets/flashoff.png",
 changeCameraIconPath: "assets/camera.png"

Customization Options:

- `lineColor`: Hex color for the scanning line.

- `cancelButtonText`: Text for the cancel button.

- `isShowFlashIcon`: Boolean to show/hide the flash icon.

- `scanMode`: Enum for QR, Barcode, or Default scanning mode.

- `iconSize`: Size of the flash and camera change icons.

- `fontSize`: Size of the cancel button text.

- `flashIconPath`, `flashOffIconPath`, `changeCameraIconPath`: Paths for custom icons.


Currently, `scanMode` only alters the overlay appearance for QR and barcodes. Regardless of the mode selected, the scanner can read both QR codes and barcodes.

Use Cases:

The flutter_scanner_devxhub plugin can be utilized in a variety of applications:

  • Retail apps can use it for scanning product barcodes or QR codes for discounts.
  • Event apps can streamline entry processes through ticket or badge scanning.
  • Document management apps can enhance their functionality with document scanning features.

Join the Community:

We are excited to see how you use flutter_scanner_devxhub in your Flutter apps. Share your projects and feedback with us on our social media channels. Your insights and experiences really help us make our tools better.

At DEVxHUB, we're dedicated to giving developers the tools they need to create awesome mobile apps. Flutter Scanner DEVxHUB shows we're serious about giving you simple, efficient, and top quality tools. Check out this new plugin and make your app even better!

Stay tuned for more updates and innovations from DEVxHUB!


By integrating flutter_scanner_devxhub into your Flutter apps, you open up a world of possibilities with barcode scanning functionality. Whether you're developing a new app or enhancing an existing one, this plugin offers a straightforward way to add a sophisticated feature that can significantly improve user interaction and functionality.

Related Posts