The BlinkID SDK is a comprehensive solution for implementing secure document scanning on the Flutter cross-platform. It offers powerful capabilities for capturing and analyzing a wide range of identification documents. The Flutter plugin consists of BlinkID, which serves as the core module, and the BlinkIDUX package that provides a complete, ready-to-use solution with a user-friendly interface.
Please note that, for maximum performance and full access to all features, it’s best to go with one of our native SDKs (for iOS or Android).
However, since the wrapper is open source, you can add the features you need on your own.
- Licensing
- Requirements
- Quickstart with the sample application
- Plugin integration
- Plugin usage
- Plugin specifics
- Additional information
A valid license key is required to initialize the BlinkID plugin. A free trial license key can be requested after registering at the Microblink Developer Hub.
Requirement | Flutter | iOS | Android |
---|---|---|---|
OS/API version | Flutter 3.29 and newer | iOS 16.0 and newer | API version 24 and newer |
Camera quality | - | At least 1080p | At least 1080p |
- For additional help with the Flutter setup, view the official documentation.
- For more detailed information about the BlinkID Android and iOS requirements, view the native SDK documentation here (Android & iOS).
The sample application demonstrates how the BlinkID plugin is implemented, used and shows how to obtain the scanned results. It contains the implementation for:
- The default implementation with the default BlinkID UX scanning experience.
- Multiside DirectAPI scanning - extracting the document information from multiple static images (from the gallery).
- Singleside DirectAPI scanning - extracting the document information from a single static images (from the gallery).
To obtain and run the sample application, follow the steps below:
- Git clone the repository:
git clone https://github.com/BlinkID/blinkid-flutter.git
- Position to the obtained BlinkID folder and run the
initBlinkIdFlutterSample.sh
script:
cd blinkid-flutter && ./initBlinkIdFlutterSample.sh
- After the script finishes running, position to the
sample
folder and run theflutter run
command:
cd sample && flutter run
- Pick the platform to run the BlinkID plugin on.
Note: the plugin can be run directly via Xcode (iOS) and Android Studio (Android):
- Open the
Runner.xcodeproj
in the path:sample/ios/Runner.xcodeproj
to run the iOS sample application. - Open the
android
folder via Android Studio in thesample
folder to run the Android sample application.
- To add the BlinkID plugin to a Flutter project, first create empty project if needed:
flutter create project_name
- Since the native BlinkID iOS SDK is only distributed via Swift Package Manager, Flutter's Swift Package Manager support also needs to be enabled:
flutter config --enable-swift-package-manager
- Add the blinkid_flutter dependency to your
pubspec.yaml
file:
dependencies:
...
blinkid_flutter:
- Run the command to install the dependency:
flutter pub get
- After the dependency has been added to the project, first add the necessary import:
import 'package:blinkid_flutter/blinkid_flutter.dart';
- Initialize the BlinkID plugin:
final blinkidPlugin = BlinkIdFlutter();
- Set all of the necessary BlinkID settings (SDK settings, session settings, and the scanning settings). If the mentioned settings are not modified, the default values will be used:
// Add the license key for each platform
var sdkLicenseKey = "";
if (Platform.isAndroid) {
sdkLicenseKey = "android-license-key";
} else if (Platform.isIOS) {
sdkLicenseKey = "ios-license-key";
}
/// Set the BlinkID SDK settings
/// Add the license key here from the code above
final sdkSettings = BlinkIdSdkSettings(sdkLicenseKey);
sdkSettings.downloadResources = true;
/// Create and modify the Session Settings
final sessionSettings = BlinkIdSessionSettings();
sessionSettings.scanningMode = ScanningMode.automatic;
/// Create and modify the scanning settings
final scanningSettings = BlinkIdScanningSettings();
scanningSettings.glareDetectionLevel = DetectionLevel.mid;
/// Create and modify the Image settings
final imageSettings = CroppedImageSettings();
imageSettings.returnDocumentImage = true;
imageSettings.returnSignatureImage = true;
imageSettings.returnFaceImage = true;
/// Place the image settings in the scanning settings
scanningSettings.croppedImageSettings = imageSettings;
/// Add the document class filter. This parameter is optional.
final classFilter = ClassFilter.withIncludedDocumentClasses([
DocumentFilter(Country.canada),
DocumentFilter(Country.usa, Region.california),
]);
- Call the appropriate scanning method (with the default UX, or DirectAPI for static images), handle the results and catch any errors:
// Call the performScan method, where the SDK and session settings need to be passed
// Here, you can also pass the optional ClassFilter object from step 3.
await blinkIdPlugin
.performScan(sdkSettings, sessionSettings) //, classFilter) -> optional
.then((blinkidResult) {
//handle the results here.
print(blinkidResult.firstName?.value);
})
.catchError((scanningError) {
// handle any errors here.
if (scanningError is PlatformException) {
print("BlinkID scanning error: $errorMessage";)
}
});
- The whole integration process can be found in the sample app
main.dart
file here. - The settings and the results that can be used with the BlinkID plugin can be found in the paragraphs below, but also in the comments of each BlinkID Dart file.
The BlinkID plugin implementation is located in the lib
folder, while platform-specific implementation is located in the android
and ios
folders.
Currently, the BlinkID plugin contains the two main methods of scanning: performScan
and performDirectApiScan
.
The performScan
method
The performScan
method launches the BlinkID scanning process with the default UX properties.
It takes the following parameters:
- BlinkID SDK settings
- BlinkID session settings
- The optional ClassFilter object for filtering documents.
BlinkID SDK Settings - BlinkIdSdkSettings
: the class that contains all of the available SDK settings. It contains settings for the license key, and how the models, that the SDK needs for the scanning process, should be obtained.
BlinkID Session Settings - BlinkIdSessionSettings
: the class that contains various settings for the scanning session. It contains the settings for the ScanningMode
and BlinkIdScanningSettings
, which define various parameters that control the scanning process.
The optional ClassFilter class - ClassFilter
: the class which controls which documents will be accepted or reject for information extraction during the scanning session.
- The implementation of the
performScan
method can be viewed here in the blinkid_flutter_method_channel.dart file.
The performDirectApiScan
method
The performDirectApiScan
method launches the BlinkID scanning process intended for information extraction from static images.
It takes the following parameters:
- BlinkID SDK settings
- BlinkID session settings
- First image string in the Base64 format
- The optional second image string in the Base64 format
BlinkID SDK Settings - BlinkIdSdkSettings
: the class that contains all of the available SDK settings. It contains settings for the license key, and how the models, that the SDK needs for the scanning process, should be obtained.
BlinkID Session Settings - BlinkIdSessionSettings
: the class that contains various settings for the scanning session. It contains the settings for the ScanningMode
and BlinkIdScanningSettings
, which define various parameters that control the scanning process.
The first image Base64 string - String
: image that represents one side of the document. If the document contains two sides and the ScanningMode
is set to automatic
, this should contain the image of the front side of the document. In case the ScanningMode
is set to single
, it can be either the front or the back side of the document. If the document contains only one side (for example, various passports), the SDK will automatically detect it, and will not look for the other side.
The optional second image Base64 string - String
: needed if the information from back side of the document is required and the ScanningMode
is set to automatic
.
- The implementation of the
performDirectApiScanning
method can be viewed here in the blinkid_flutter_method_channel.dart file.
The BlinkID SDK contains various settings, modifying different parts of scanning process:
-
BlinkID SDK settings -
BlinkIdSdkSettings
These settings are used for the initialization of the BlinkID SDK. -
BlinkID session settings -
BlinkIdSessionSettings
These settings represent the configuration settings for a scanning session.
This class holds the settings related to the resources initialization, scanning mode, and specific scanning configurations that define how the scanning session should behave. -
BlinkID scanning settings -
BlinkIdScanningSettings
These settings represent the configurable settings for scanning a document.` This class defines various parameters and policies related to the scanning process, including image quality handling, data extraction and anonymization, along with options for frame processing and image extraction. -
Cropped image settings -
CroppedImageSettings
These settings represent the image cropping settings.
Additional notes:
-
The blinkid_settings.dart file contains all the settings that can be modified and explains what each setting does in more detail.
-
The native documentation for the above mentioned settings can be found here for Android & iOS.
-
The native Kotlin & Swift implementation of all BlinkID settings can be found here for Android & iOS in the BlinkID deserialization utilities.
The result of the scanning process is stored in the BlinkIdScanningResult
. It contains the results of scanning a document, including the extracted data and images from the document.
Along with the information scanned from the document, the BlinkID also provides additional details that was obtained during the scanning process:
-
Recognition mode-
RecognitionMode
Scanning mode used to scan the current document. -
Document class info -
DocumentClassInfo
The document class information. -
Data match informatoin -
DataMatchResult
Info on whether the data extracted from multiple sides matches. -
Singleside scanning result -
SingleSideScanningResult
Represents the result of scanning a single side of the document.
Contains the data extracted from the Visual Inspection Zone, Machine Readable Zone, barcode, the input image, and the cropped document, face, and signature images. -
Detailed cropped image result -
DetailedCroppedImageResult
Represents the result of the image crop transformation with additional details.
Additional notes:
-
The blinkid_result.dart file contains all the results that can be obtained and explains what each result represents in more detail.
-
The native documentation for the above mentioned results can be found here for Android & iOS.
-
The native Kotlin & Swift implementation of all BlinkID results can be found here for Android & iOS in the BlinkID serialization utilities.
For any additional questions and information, feel free to contact us here, or directly to the Support team via mail support@microblink.com.