Skip to main content

Flutter MRZ Scanner UI Components - SDK Features

Introduction

The Scanbot SDK provides the ability to find and extract Machine Readable Zone (MRZ) content from ID cards, passports and travel documents.

Depending on the type of document, the following fields can be extracted:

  • document code
  • first name
  • last name
  • issuing state or organization
  • department of issuance
  • nationality
  • date of birth
  • gender
  • date of expiry
  • personal number
  • optional fields
  • discreet issuing state or organization
  • valid check digits count
  • check digits count
  • travel document type

The MRZ scanner is available as an RTU-UI component (types of components are explained here).

Take a look at our Example Apps to see how to integrate the MRZ Scanner.

Machine Readable Zone Scanner RTU-UI Component

ScanbotSdkUi.startMrzScanner(config)

Opens a scanner to scan and extract MRZ data (Machine Readable Zones) on ID cards, passports, etc.

alt

var config = MrzScannerConfiguration(
topBarBackgroundColor: Colors.pink,
cameraOverlayColor: Colors.black.withAlpha(150),
cancelButtonTitle: "Cancel",
...
);
var result = await ScanbotSdkUi.startMrzScanner(config);
// result.document ...
  • result.operationResult

    • SUCCESS if MRZ data was detected
    • CANCELED if the user canceled the operation (tapped on the "cancel" button)
    • ERROR if an error occurred
  • result.document - wrapped mrz document:

    /// Unknown
late TextFieldWrapper? unknown;
/// Document number
late TextFieldWrapper? documentNumber;
/// Issuing authority
late TextFieldWrapper? issuingAuthority;
/// Office of issuance
late ValidatedTextFieldWrapper? officeOfIssuance;
/// Date of issuance
late ValidatedTextFieldWrapper? dateOfIssuance;
/// Given names
late TextFieldWrapper givenNames;
/// Surname
late TextFieldWrapper surname;
/// Nationality
late TextFieldWrapper nationality;
/// Birth date
late TextFieldWrapper birthDate;
/// Gender
late TextFieldWrapper? gender;
/// Expiry date
late ValidatedTextFieldWrapper? expiryDate;
/// Personal number
late ValidatedTextFieldWrapper? personalNumber;
/// Travel document type
late TextFieldWrapper? travelDocType;
/// Travel document type variant
late TextFieldWrapper? travelDocTypeVariant;
/// Optional 1
late ValidatedTextFieldWrapper? optional1;
/// Optional 2
late ValidatedTextFieldWrapper? optional2;
/// Document type code
late TextFieldWrapper? documentTypeCode;
/// PIN code
late TextFieldWrapper? pinCode;
/// Language code
late TextFieldWrapper? languageCode;
/// Version number
late TextFieldWrapper? versionNumber;
/// Check digit document number
late ValidatedTextFieldWrapper? checkDigitDocumentNumber;
/// Check digit birth date
late ValidatedTextFieldWrapper? checkDigitBirthDate;
/// Check digit expiry date
late ValidatedTextFieldWrapper? checkDigitExpiryDate;
/// Check digit personal number
late ValidatedTextFieldWrapper? checkDigitPersonalNumber;
/// Check digit general
late ValidatedTextFieldWrapper? checkDigitGeneral;

MrzScannerConfiguration

The finder window must have a width-to-height of 5, otherwise the detection process will fail. All other settings are optional.

  /// The preferred camera module (default - BACK)
CameraModule? cameraModule;

/// Background color outside of the finder window.
Color? cameraOverlayColor;

/// Title of the cancel button.
String? cancelButtonTitle;

/// Whether the cancel button is hidden or not. iOS only.
bool? cancelButtonHidden;

/// Title of the button that opens the screen where the user can allow the usage of the camera by the app.
String? enableCameraButtonTitle;

/// Text that will be displayed when the app is not allowed to use the camera, prompting the user to enable the usage of the camera.
String? enableCameraExplanationText;

/// Foreground color of the detection overlay.
Color? finderLineColor;

/// Width of finder frame border. Default is 2.
double? finderLineWidth;

/// String being displayed as description.
String? finderTextHint;

/// Foreground color of the description label.
Color? finderTextHintColor;

/// Aspect ratio of finder frame (width \ height), which is used to build actual finder frame. Default is 7 - which is good for standard machine readable zones.
AspectRatio? finderAspectRatio;

/// Controls whether the flash toggle button is hidden or not. iOS only.
bool? flashButtonHidden;

/// Title of the flash toggle button. iOS only.
String? flashButtonTitle;

/// Controls whether the flash should be initially enabled. The default value is FALSE.
bool? flashEnabled;

/// UI Interface orientation lock mode
OrientationLockMode? orientationLockMode;

/// Controls whether to play a beep sound after a successful detection. Default value is TRUE.
bool? successBeepEnabled;

/// The background color of the top toolbar.
Color? topBarBackgroundColor;

/// The color of all active toggle buttons in the toolbar.
Color? topBarButtonsActiveColor;

/// The color of all inactive toggle buttons in the toolbar.
Color? topBarButtonsInactiveColor;

/// Controls whether buttons should use all capitals style, as defined by the Android Material Design. Defaults to TRUE. Android only.
bool? useButtonsAllCaps;

/// If `true`, replaces the cancel button in the top bar with a back arrow icon. The default value is FALSE. Android only.
bool? replaceCancelButtonWithIcon;

/// Preview mode of the camera. FILL_IN or FIT_IN. Default is FILL_IN. Android only
CameraPreviewMode? cameraPreviewMode;

/// Whether touch-to-focus is enabled on camera preview. Enabled by default. Android only.
bool? touchToFocusEnabled;

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?