Add the SDK to Your App#
This guide shows you how to add the Scandit Data Capture SDK to current existing project.
The latest stable version of the Flutter SDK (for example through the latest Android Studio).
A project with minimum iOS deployment target of 9.0 or higher. Or an Android project with target SDK version 21 (5.0 Lollipop) or higher, and Kotlin 1.4.10 or higher.
A valid Scandit Data Capture SDK license key. You can sign up for a free test account at ssl.scandit.com.
Android devices running the Scandit Data Capture SDK need to have a GPU or the performance will drastically decrease.
Get a License Key#
If you don’t have a Scandit account yet, create a free test account at ssl.scandit.com.
Sign in to your account at ssl.scandit.com/sessions/new.
Select “License Keys” from the left-hand menu.
If you don’t have a license key for your app yet, click “Create native SDK license key” and enter the bundle ID for your project.
Copy the license key.
If you have a paid subscription, please reach out to email@example.com if you need a new license key.
Add the SDK#
Currently we support adding the Scandit Data Capture SDK Flutter plugins to your project in two ways. The simplest way is to use the pub.dev registry, alternatively you can manually download the plugins and add them to your project.
1. Create a new project (optional)#
If you do not have a Flutter project yet that you’ll use, you should create a new one (using your IDE of choice: Android Studio or IntelliJ).
2a. Add the Scandit Data Capture SDK from the pub.dev registry#
To add our plugins from the pub.dev registry, you need to open the pubspec.yaml file located inside the app folder, and add required Scandit plugin(s) under dependencies. In the following snippet we’re adding ScanditBarcodeCapture API
dependencies: flutter: sdk: flutter scandit_flutter_datacapture_barcode: <version>
2b. Add the Scandit Data Capture SDK manually#
After you download the archive containing all the plugins at ssl.scandit.com/sdk, unzip the archive. It includes the available Flutter plugins, including the scandit-flutter-datacapture-core plugin that all other plugins depend on.
Move the required Scandit Data Capture SDK Flutter plugins to some subdirectory within your app folder, e.g. to libs/ and then open the pubspec.yaml file located inside the app folder, and add required Scandit plugin(s) under dependencies. In the following snippet we’re adding ScanditBarcodeCapture API
dependencies: flutter: sdk: flutter scandit_flutter_datacapture_barcode: path: libs/scandit-flutter-datacapture-barcode
You don’t need to add the dependency to the scandit-flutter-datacapture-core plugin in the pubspec.yaml. However, all the other Scandit Flutter plugins depend internally on it, so you still have to copy it to the same location as the other plugins.
3. Install Scandit Data Capture SDK Flutter plugin(s)#
Run from terminal
flutter pub get
Or perform the install from from Android Studio/IntelliJ: click Packages get in the action ribbon at the top of pubspec.yaml.
Camera Permissions: When using the Scandit Data Capture SDK you will want to set the camera as the frame source for various capture modes. On Android, you have to request camera permissions in your own application before starting scanning. To see how you can achieve this, take a look at our samples: Run our Sample Apps.
Remember that, if you want to use the camera as the frame source for barcode, text and label capture, you need to set the “Privacy - Camera Usage Description” field in the Info.plist file for iOS.