Skip to main content

Flutter Barcode Scanner SDK - Getting Started

Installation

The Scanbot Barcode Scanner SDK Flutter Plugin is available as a Flutter Dart package barcode_scanner on pub.dev. You can simply add it as a dependency to your app.

Add the barcode_scanner plugin to your pubspec.yaml file as dependencies:

dependencies:
barcode_scanner: ^3.6.0 # use the latest plugin version

Use the Flutter CLI (or your IDE) to fetch and install the packages:

$ flutter pub get

Android

In the top-level android/build.gradle file:

  • Update Kotlin version to at least 1.3.61 or higher. Typically defined via ext.kotlin_version variable:

    ...
    buildscript {
    ext.kotlin_version = '1.3.61'
    ...
    }

In the app-level android/app/build.gradle file:

  • Add the following packagingOptions

      android {
    ...
    packagingOptions {
    pickFirst 'META-INF/atomicfu.kotlin_module'
    pickFirst 'META-INF/proguard/coroutines.pro'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    }
    }

In the android/app/src/main/AndroidManifest.xml file:

  • Add the CAMERA permission:
    <uses-permission android:name="android.permission.CAMERA" />

iOS

For iOS you need to adjust the Podfile and install or update the Pods:

Make sure you have specified a global platform version in the ios/Podfile file, like:

platform :ios, '9.0'

Then run:

$ cd ios/
$ pod install

In your Info.plist file add the required NSCameraUsageDescription property:

NSCameraUsageDescription - "Privacy - Camera Usage Description". Describe why your app wants to access the camera.

Please note that without this property the app will crash on camera access!

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?


On this page

Scroll to top