Skip to main content

SDK Initialization | Flutter Document Scanner

The Scanbot SDK must be initialized before usage. Make sure to call the initialization after entering the main widget creation.

To initialize the SDK, add the following code snippet:

Initialize Scanbot SDK
loading...

All available initialization options are documented in SdkConfiguration.

Add Scanbot SDK license key

info

You can use the Scanbot SDK for quick testing or evaluation purposes even without a license key. However, the SDK will only work for 60 seconds per app session and may not be used for production purposes. Want to scan longer than 60 seconds? Get your free trial license key here.

Example code for initialization with license:

Initialize With License
loading...

You will be unable to use any of the SDK features if the license key is corrupted, expired, or invalid in any other way.

Please make sure that you have inserted the exact key as it was provided by us, including all encoded line breaks \n.

App Identifier

Every app has a unique identifier (also known as "bundle identifier" or "application ID"). Your license will be bound to this identifier.

To request a trial license or purchase a production license, you need to provide the app identifier of your application.

For Android: Please see the applicationId in the app-level build.gradle file of your android project:

defaultConfig {
...
applicationId "io.scanbot.example.app.flutter"
}

For iOS: In Xcode see the Bundle Identifier in the "General" settings tab of your project.

Image Quality / Compression

The initialize method can take some optional parameters that specify the image storage format and compression for generated images.

Initialize With Image Quality
loading...
  • storageImageQuality - defines the quality factor of JPEG images. The value must be between 1 and 100, where 100 means maximum quality and largest file size. The default value is 80 which is a good compromise between image file size and document legibility.
  • storageImageFormat - either JPG or PNG. The default value is JPG.

License handling

caution

If your Scanbot SDK license has expired, any call to the Scanbot SDK API will return empty results. To prevent this you should always check for license expiration during the runtime via ScanbotSdk.getLicenseInfo(). If the result of result.value.isValid is false, you should disable any usage of the Scanbot SDK (functions, UI components, etc).

See license handling section to learn how to handle the different license statuses in your app.

Logging

When initializing the Scanbot SDK you can enable logging of the SDK. By default logging is disabled.

Initialize With Logging
loading...

On Android logs are printed into LogCat as well as saved on the device. The easiest way to check the log outputs on Android is to use Android Debug Bridge (adb). (e.g. $ adb -s <DEVICE_ID> shell "logcat")

On iOS all logs are printed to the console. Please use Xcode to check the log outputs. There will be no log files created by the Scanbot SDK plugin.

Please note: While it may be useful for development, consider switching logging OFF in production builds for security and performance reasons!

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get free trial license