> For the complete documentation index, see [llms.txt](https://doc.faceplugin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.faceplugin.com/products/id-document-recognition-sdk/recognition-and-liveness/mobile-sdk/id-document-recognition-flutter-sdk.md).

# Flutter

Faceplugin ID Document Recognition Flutter SDK. On-premise OCR, MRZ, and authenticity. document\_reader\_sdk plugin for Android and iOS.

Fully on-premise **ID Document Recognition SDK for Flutter**. Package: `document_reader_sdk`. Android output is **normalized** to the iOS-shaped JSON. Parse it with [Document result JSON](/products/id-document-recognition-sdk/document-result-json.md).

### Code <a href="#setup" id="setup"></a>

{% embed url="<https://github.com/Faceplugin-ltd/ID-Document-Recognition-Flutter>" %}

### How to Run

{% stepper %}
{% step %}

## Install tools

Flutter **3.44+** (see the package `pubspec.yaml`). JDK **17**. Run `flutter doctor` and fix reported issues.
{% endstep %}

{% step %}

## Clone and bootstrap

```
git clone https://github.com/Faceplugin-ltd/ID-Document-Recognition-Flutter.git
cd ID-Document-Recognition-Flutter
dart run tool/bootstrap.dart
```

{% endstep %}

{% step %}

## Place native runtimes

| Platform | File                    | Example app path             | Your own app path        |
| -------- | ----------------------- | ---------------------------- | ------------------------ |
| Android  | `documentreadersdk.aar` | `example/android/libdocsdk/` | Plugin `android/libs/`   |
| iOS      | `docsdk.framework`      | `ios/Frameworks/`            | Plugin `ios/Frameworks/` |

* Android Google Drive: [documentreadersdk.aar](https://drive.google.com/drive/folders/1nDSfvj0WtC1lZgzwFd7471ECVtk-nuYH)
* iOS Google Drive: [docsdk.framework](https://drive.google.com/drive/folders/1do6Ws_BlXGkR_K9jI_ULd1zHjqLGSP4q)
  {% endstep %}

{% step %}

## Run the example

```
cd example
flutter pub get
flutter run
```

Physical phone. Keep Android `com.faceplugin.documentreader`, iOS `com.faceplugin.documentreader.app`.
{% endstep %}
{% endstepper %}

### License

Licenses are **offline**. Request a new license key for your own app.

### Integrate into your own app

```yaml
dependencies:
  document_reader_sdk:
    git:
      url: https://github.com/Faceplugin-ltd/ID-Document-Recognition-Flutter.git
```

Then `flutter pub get`, copy runtimes, `cd ios && pod install`, and **rebuild** the native app.

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

Future<void> boot() async {
  final machine = await getMachineCode(); // machine code
  final act = await setActivation('license key');
  if (act != sdkSuccess) {
    print(await lastLicenseError());
    return;
  }
  final code = await init();
  if (code != sdkSuccess) return;

  final locateJson = await locateDocument(imagePath);
  final resultJson = await recognize(frontPath, backPath, true);
}
```

Authenticity accepts `true` / `false` or `'normal'` / `'none'`. Image input: file path, `file://` URI, content URI, or base64 / `data:` URL.

### APIs

Status codes: **0** Success, **1** Invalid license, **2** Expired, **3** Not activated, **4** Init failed.

#### <mark style="color:orange;">setActivation:</mark> This API is used to activate the SDK

```dart
Future<int> setActivation(String license)
```

#### <mark style="color:orange;">init:</mark> This API is used to initialize the SDK

```dart
Future<int> init()
```

#### <mark style="color:orange;">getMachineCode:</mark> This API is used to retrieve the machine code

```dart
Future<String> getMachineCode()
```

#### <mark style="color:orange;">locateDocument:</mark> This API is used to find document corners on a preview frame

```dart
Future<String> locateDocument(ImageInput image)
```

#### <mark style="color:orange;">recognize:</mark> This API is used to run FullProcess

```dart
Future<String> recognize(ImageInput front, [ImageInput? back, Object authenticity = true])
```

#### <mark style="color:orange;">documentRecognition:</mark> This API is used to run OCR / MRZ / barcode / image quality only

```dart
Future<String> documentRecognition(ImageInput front, [ImageInput? back])
```

#### <mark style="color:orange;">documentLiveness:</mark> This API is used to run authenticity / security only

```dart
Future<String> documentLiveness(ImageInput front, [ImageInput? back])
```

Also: `getLicenseStatus`, `startNewSession`, `recognizeResult` (typed `DocResult`), `deinit`.

[Request a License & Support](/help/request-a-license-and-support.md) · [Contact us](/help/contact-us.md)

### FAQ

**Package?** `document_reader_sdk`.

**Passport OCR?** Yes. `recognize` / `documentProcess`. Typed helper: `recognizeResult`.

### Related documentation

* [Faceplugin ID Document Recognition Mobile SDK](/products/id-document-recognition-sdk/recognition-and-liveness/mobile-sdk.md) · [React Native](/products/id-document-recognition-sdk/recognition-and-liveness/mobile-sdk/id-document-recognition-react-native-sdk.md) · [Glossary](/help/resources/glossary.md)
* [Face Recognition Flutter SDK](/products/face-recognition-sdk/recognition-and-liveness/mobile-sdk/face-recognition-flutter-sdk.md)
* [Document result JSON](/products/id-document-recognition-sdk/document-result-json.md)
* [Request a License](/help/request-a-license-and-support.md) · [Status codes](/help/resources/status-codes.md)
* [Combining products (eKYC)](/getting-started/choose-a-product.md) · [SDK comparison](/help/comparisons.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.faceplugin.com/products/id-document-recognition-sdk/recognition-and-liveness/mobile-sdk/id-document-recognition-flutter-sdk.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
