Smile Identity
Search…
⌃K

ID Card Capture

ID Card Capture will capture an id card image for a tag that may be provided during initiation and if not provided this will be auto generated by the SDK and returned with a code.

ID Card Capture

ID Card Capture will capture an id card image for a tag that may be provided during initiation and if not provided this will be auto generated by the SDK and returned with a code.

Import the library

import 'package:smile_flutter/smile_flutter.dart';

Capture ID Card

If you want the SDK to generate a tag for you then call the method with an empty string
var result = await SmileFlutter.captureIDCard("") ;
If you want the generate to use a custom tag send a string to the SDK with alphanumeric characters with the exception of an underscore and no spacing in them.
var result = await SmileFlutter.captureIDCard(<STRING_TAG>);
This will present a screen as belowID Card Capture

Get Results

The selfie capture process is an asynchronous process and will return an error code and a tag once done. The result looks as the below
var resultCode = result!["SID_RESULT_CODE"];
var resultTag = result["SID_RESULT_TAG"];
If the result code is -1 AND the tag is not null or empty then the selfie capture was successful.

Optional Permissions

By default the SDK will request for permissions on it's own particularly on android and the first instance the call to the captureSelfie may fail and will definately fail if the user has not allowed the permissions for camera
It is advisable to then do permissions request prior to calling the captureSelfie method to make sure you handle permissions and perhaps even check for permissions before in that case then the call should be
var result = await SmileFlutter.captureIDCard("", HashMap<String, String>(),false)
The false will mean the SDK will try to open the selfie capture and assume permission handling has already been done

Optional UI Customisations

For basic UI customisation, an additional key-value Hashmap needs to be passed as second parameter when performing a call to the library's captureSelfie("<TAG>",HashMap<String, String>(),false)
) method, where tag is a string and config the added key-value Map containing the desired settings.
var config = HashMap<String, String>();
config["capture_title_text"] = "Capturing your smile..."";
var result = await SmileFlutter.captureSelfie("", config) ?? null;

Basic Example

  • id_capture_side: a string value with options 0,1,2 0 being capture front only, 1 being capture front and back and 2 being capture back only
  • id_capture_orientation: a string that determines the prompt text view on the selfie review screen; this text view refers to the one directly under the selfie image view
var config = HashMap<String, String>();
config["id_capture_side"] = "0";
config["id_capture_orientation"] = "2";
var result = await SmileFlutter.captureIDCard("test_tag",config) ?? null;