---
title: Document capture
canonical: https://developer.unico.io/dual-api/developer/sdks-and-tools/flutter-sdk/document-capture/
locale: en
generated_by: markdown-export
---

Capture of identity documents. The SDK presents a frame to assist the user in positioning the document; after positioning, the user clicks the button to capture the photo.

:::warning[No content validation]
The SDK does not perform any type of validation on what is being captured.
:::

## Available document frames

| Frame | Description |
|---|---|
| `DocumentCameraTypes.CPF` | Capture the CPF |
| `DocumentCameraTypes.CNH` | Capture the open CNH |
| `DocumentCameraTypes.CNH_FRENTE` | Capture the front of the CNH |
| `DocumentCameraTypes.CNH_VERSO` | Capture the back of the CNH |
| `DocumentCameraTypes.RG_FRENTE` | Capture the front of the RG |
| `DocumentCameraTypes.RG_VERSO` | Capture the back of the RG |
| `DocumentCameraTypes.OUTROS("descrição")` | Generic frame for any other document |

:::tip[Generic frame]
If you need to capture a document for which there is no specific frame (e.g., RNE), use `DocumentCameraTypes.OUTROS("description")` — a generic, rectangular frame that can be used to guide any capture.
:::

For the full list of supported document types, see [API Reference > Enums](/developers/sdks-and-tools/flutter/api-reference/enums).

## Starting a document capture

****Step 2** — Implement the document listeners**

Add the document callbacks to your state class:

  | Method | Description |
  |---|---|
  | `onSuccessDocument(ResultCamera resultCamera)` | Capture succeeded — returns `ResultCamera` with `base64` (preview) and `encrypted` (JWT for the API) |
  | `onErrorDocument(UnicoError error)` | Capture failed — returns a `UnicoError` with code and description |

  ```dart
  @override
  void onSuccessDocument(ResultCamera resultCamera) { }

  @override
  void onErrorDocument(UnicoError error) { }
  ```

****Step 3** — Call `openCameraDocument`**

The `openCameraDocument()` method is provided through the object generated with an instance of the `UnicoCheck` class. It takes:

  - A JSON file with the credentials, generated in the [credential setup step](/developers/sdks-and-tools/flutter/installation/specific-setup);
  - The document type to be captured (`DocumentType` enum);
  - The listener configured in Step 2.

  Example using the open CNH:

  ```dart
  _unicoCheck.build().openCameraDocument(
    jsonFileName: androidJsonFileName,
    documentType: DocumentType.CNH,
    listener: this,
  );
  ```

For the full result handling, see [Receiving the result](/developers/sdks-and-tools/flutter/capture-flow/receiving-the-result).