> For the complete documentation index, see [llms.txt](https://legacy-docs.usesmileid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacy-docs.usesmileid.com/integration-options/mobile/flutter/selfie-and-id-card-capture.md).

# Selfie and ID Card Capture

### Import the library

```
import 'package:smile_flutter/smile_flutter.dart';
```

### Capture Selfie

If you want the SDK to generate a tag for you then call the method with an empty string

```
var result = await SmileFlutter.captureSelfieAndIDCard("") ;
```

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.captureSelfieAndIDCard(<STRING_TAG>) ;
```

This will present the two screen as below in the order selfie then id card capture

![](/files/-MdDbISL6RmqmD0Nl15C)

![](/files/-MdDbioiojSDeyUo2Qkb)

### 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.captureSelfieAndIDCard("", 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 Object 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.

### Selfie Capture Screen Customisation

* `capture_title_text`: a string value for the selfie capture screen's title. Refer to [Strings and Colours section for details](https://readme.so/s_and_c_section).
* `overlay_color`: a 7-character (no alpha channel) hexadecimal color string (ie. `#FF0000` for red) that sets the background color for the oval overlay view in the selfie capture screen
* `overlay_alpha`: an integer value ranging from 0 to 255 that controls the transparency of the oval overlay view in the selfie capture screen
* `overlay_thickness`: an non-bound integer value that determines the thickness of the oval overlay's line
* `overlay_dotted`: a boolean value that specifies whether the oval overlay's line should dotted or plain (the latter by default).
* `overlay_width`: a non-bound integer value that sets the oval shape's width in the selfie capture screen
* `overlay_height`: same as the above, for the oval shape's height
* `capturing_progress_color`: a 7-character (no alpha channel) hexadecimal color string (ie. `#FF0000` for red) that determines the color of the oval overlay during selfie capture
* `captured_progress_color`: a 7-character (no alpha channel) hexadecimal color string (ie. `#FF0000` for red) that determines the color of the oval overlay after selfie capture
* `prompt_default_text`: a string that determines the default text when the selfie capture view is initialise; this refers to text view directly under the selfie capture view
* `prompt_blurry_text`: a string that informs the user that selfie is blurry
* `prompt_capturing_text`: a string that informs the user that the selfie capture operation is underway
* `prompt_do_smile_text`: a string used to prompt the user to smile
* `prompt_compatibility_mode_text`: a string for compatibility-related issue
* `prompt_face_not_found_text`: a string that determines the error message when the face is not found during selfie capture
* `prompt_face_too_close_text`: a string that informs the user that they're positioned outside the acceptable selfie capture distance range
* `prompt_idle_text`: a string that informs the user that the selfie capture has remained idle for long
* `prompt_move_closer_text`: a string that prompts the user to move closer to the camera during selfie capture
* `prompt_too_dark_text`: a string used to notify the user that brightness and light intensity is low
* `capture_tip_text`: a string used for the tips at the bottom of the selfie capture screen

### Selfie Review Screen Customisation

* `review_title_text`: a string value for the selfie review screen's title.
* `review_prompt_text`: 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
* `review_prompt_style`: a key-value Object that determines the styling for the ***prompt*** text view (the text view directly under the the selfie image view)'s styling - similar to [screen\_title\_style](https://readme.so/editor#screen_title_style)
* `review_tip_text`: a string used for the tips at the bottom of the selfie capture screen
* `review_tip_style`: a key-value Object that sets the styling for the ***tips*** text view (the text view directly under the ***prompt*** text view in the selfie review screen)'s styling - similar to [screen\_title\_style](https://readme.so/editor#screen_title_style)
* `review_confirm_text`: a string value for the ***confirm button*** (positive action)'s text
* `review_confirm_color`: a 7-character (no alpha channel) hexadecimal color string (ie. `#FF0000` for red) that determines the the ***confirm button***'s background color

### ID Card Capture Screen

*
* `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 document capture screen; this text view refers to the one directly under the selfie image view
* `id_prompt_blurry`: a string that determines the ***prompt*** text view on the document capture screen whilst the SDK is capturing an image but the image is blurry
* `id_prompt_detecting_face`: a string that determines the ***prompt*** text view on the document capture screen when the SDK has captured a front of id image and facial detection is in progress
* `id_prompt_face_detected`:a string that determines the ***prompt*** text view on the document capture screen when the SDK has captured a front of id image and has detected a face
* `id_prompt_fit_id`: a string that determines the ***prompt*** text view on the document capture screen whilst the SDK is capturing and is the default instruction to the user when all conditions are perfect for capture
* `id_prompt_flash_missing`: a string that determines the ***prompt*** text view on the document capture screen whilst the SDK is capturing an image but there is no sufficient light and no flash light available on the device
* `id_prompt_insufficient_light`: a string that determines the ***prompt*** text view on the document capture screen whilst the SDK is capturing an image but there is no sufficient light
* `id_prompt_loading`: a string that determines the ***prompt*** text view on the document capture screen when the SDK has captured an image and quality checks are in progress
* `id_prompt_no_face_detected`: a string that determines the ***prompt*** text view on the document capture screen when the SDK has captured a front of id image but there is no face that has been detected
* `id_prompt_back_id`: a string that determines the ***prompt*** text view on the document capture screen when the SDK has captured a back of id image
* `id_prompt_captured_blurry`: a string that determines the ***prompt*** text view on the document capture screen when the captured image is blurry
* `id_prompt_captured_dark`: a string that determines the ***prompt*** text view on the document capture screen when the captured image does not have sufficient lighting
* `card_type`: a string that determines the aspect ratio for the document being captured
  * card => Aspect ratio 1.4 or normal credit card sized id types
  * passport => Aspect ratio 1.6 or normal passport size ids
  * other => will default to 1.4

### Basic Example

```
var config = HashMap<String, String>();
config["capture_title_text"] = "Capturing your smile..."";
var result = await SmileFlutter.captureSelfieAndIDCard("", config) ?? null;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://legacy-docs.usesmileid.com/integration-options/mobile/flutter/selfie-and-id-card-capture.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
