Onfido logo home page
Watch a demo
Get in touch
Arrow back Back to guides

Onfido Studio: Flutter SDK integration

Start here

This is an introductory guide to integrating Onfido Studio - our drag and drop interface for building, managing, and deploying identity verification journeys - with Onfido’s Flutter SDK. For more general information regarding Onfido Studio, please see our product guide.

Getting started

All of the interactive tasks of an end-user’s verification journey designed and built using Onfido Studio are managed by our SDKs.

The Onfido Flutter SDK communicates directly and dynamically with active Studio workflows to display the relevant screens to ensure the correct capture and upload of user information, such as identity documents, selfie photos and videos. As a result, the SDK flow will vary depending on the workflow configuration. You won't need to specify any steps directly in the SDK integration as these will be overridden when the workflow run ID is passed into the SDK initialization.

SDK tokens are required to authenticate the SDKs for workflows. You can generate SDK tokens using the Onfido API.

The Flutter SDK supports:

  • Dart 2.12 or higher
  • Flutter 1.20 or higher
  • iOS 11+
  • Android API level 21+
  • iPads and tablets

Create a workflow run

As a first step, you will need to create a Workflow Run by making a call to the Onfido API. At a minimum, you will need to provide a workflow_id from a valid, active workflow, as well as an Applicant ID. More details on creating a workflow run can be found in our API reference.

The server will return a workflow run object, with a workflow run ID contained in the response:

HTTP/1.1 201 Created
Content-Type: application/json

{
  "id": "<WORKFLOW_RUN_ID>",
  "applicant_id": "<APPLICANT_ID>",
  "workflow_id": "<WORKFLOW_ID>",
  "workflow_version_id": 11,
  "status": "approved",
  "dashboard_url":"https://dashboard.onfido.com/results/<WORKFLOW_RUN_ID>"
  "output": {"prop1": "val_1", "prop2": 10}, 
  "reasons": ["reason_1", "reason_2"],
  "error": null,
  "created_at": "2022-06-28T15:39:42Z",
  "updated_at": "2022-07-28T15:40:42Z",
  "link": {
      "completed_redirect_url": "https://example.onfido.com",
      "expired_redirect_url": "https://example.onfido.com",
      "expires_at": "2022-10-17T14:40:50Z",
      "language": "en_US",
      "url": "https://eu.onfido.app/l/<WORKFLOW_RUN_ID>"
  },
}

Add the SDK dependency

Using pub.dev

The SDK is available on pub.dev and you can include it in your project by running the following script from your project folder:

flutter pub add onfido_sdk

Update your iOS configuration files

Change ios/Podfile to use version 11:

platform :ios, '11.0'

The SDK uses the device camera. You're required to have the following keys in your application's ios/Runner/Info.plist file:

  • NSCameraUsageDescription
  • NSMicrophoneUsageDescription
<key>NSCameraUsageDescription</key>
<string>Required for document and facial capture</string>
<key>NSMicrophoneUsageDescription</key>
<string>Required for video capture</string>

Note: All keys will be required for app submission.

Initialize the SDK for Studio

Now you can initialize the SDK, using your generated SDK token and workflow run ID.

Build a configuration object

final Onfido onfido = Onfido(
  sdkToken: '<YOUR_SDK_TOKEN>'
);

Start the flow

await onfido.startWorkflow('<YOUR_WORKFLOW_RUN_ID>');
// listen for the result

Handling callbacks

To receive the result from a completed workflow, you should use async await with try and catch.

The following code is provided as an example:

try { 
    final Onfido onfido = Onfido(
        sdkToken: '<YOUR_SDK_TOKEN>'
    );

    await onfido.startWorkflow('<YOUR_WORKFLOW_RUN_ID>');
    // User completed the flow
} catch(error) { 
    // Error occurred
}

ATTRIBUTE NOTES
.success Callback that fires when all interactive tasks in the workflow have been completed. On success, if you have configured webhooks, a notification will be sent to your backend confirming the workflow run has finished. You do not need to create a check using your backend as this is handled directly by the Workflow
.error(Error) Callback that fires when an error occurs

Customizing the SDK

The Flutter SDK has multiple customizable features that provide flexibility, while also being easy to integrate.

UI Customization

The SDK supports UI customization. For more information, please see our SDK customization guide.

Language localization

The SDK also supports language localization. Please refer to the SDK language localization documentation for more details.

Onfido

Our solutions

Onfido uses 256-bit SSL encryption 100% of the time on every device.

BSI ISO/IEC27001

Onfido has been certified by BSI to ISO 27001 under certificate number IS 660122.

© Onfido™, 2022. All rights reserved.
Company Registration Number: 07479524.