User Journeys
User Journeys are multi-step capture sessions orchestrated by the SDK in conjunction with the configured flow. For example, the idchecktrustdocssign flow executes selfie + document + signature in a single session.
The available journeys depend on the flow configured for your integration. Refer to Use Cases for the full mapping of use case → flow → capability.
The plugin delegates to the underlying native SDKs:
- The plugin opens the camera (Android or iOS) with the SmartFrame overlay.
- The native SDK orchestrates the sequence of captures required for the flow (selfie, document, signature).
- The SDK internally forwards the results to Unico — the client never receives or manages image data directly.
- Returns a
SuccessResultobject with aprocessIdvia the platform channel.
The orchestration is handled entirely by the SDK — you do not need to implement the step sequence in your Dart code.
The SDK has intelligent framing and automatic capture enabled by default. Configure the camera mode in your builder as follows:
UnicoCheckCameraOpener _opener = new UnicoCheck(this)
.setAutoCapture(autoCapture: true)
.setSmartFrame(smartFrame: true)
.build();
The false/true values for the methods above do not change the capture experience; they are used only for the internal logic of the SDK.
Step 1 — Implement UnicoListener
UnicoListener handles the SDK lifecycle callbacks. Implement the four mandatory methods:
| Method | When it's called |
|---|---|
onErrorUnico(error) | An error occurred during SDK operation |
onUserClosedCameraManually() | The user manually closed the camera |
onSystemClosedCameraTimeoutSession() | The 40-second session limit was reached |
onSystemChangedTypeCameraTimeoutFaceInference() | No face detected for 13 seconds — switches to manual capture |
class _MyHomePageState extends State<MyHomePage> implements UnicoListener {
late UnicoCheckBuilder _unicoCheck;
@override
void onErrorUnico(UnicoError error) {}
@override
void onUserClosedCameraManually() {}
@override
void onSystemClosedCameraTimeoutSession() {}
@override
void onSystemChangedTypeCameraTimeoutFaceInference() {}
}
All four listener methods above must be created in your project (even without any logic). Otherwise, the project will not compile successfully.
Step 2 — Implement the journey listeners on UnicoSelfie
Add the journey callbacks to your state class:
| Method | Description |
|---|---|
onSuccess(SuccessResult result) | Capture succeeded — returns SuccessResult with processId (Unico processes the image internally) |
onErrorSelfie(UnicoError error) | Capture failed — returns a UnicoError with code and description |
Unlike the Liveness flow, the User Journey callback does not return base64 or encrypted. Unico handles the image processing internally and returns only a processId.
@override
void onSuccess(SuccessResult result) {
debugPrint('processId: ${result.processId}');
}
@override
void onErrorSelfie(UnicoError error) { }
Step 3 — Call openCameraSelfie
The openCameraSelfie method opens the camera. For User Journeys, pass the webAppToken provided by Unico instead of a JSON credentials file:
_opener.openCameraSelfie(
listener: this,
webAppToken: token,
);
The openCameraSelfie method provides an overload that accepts metadata via UnicoCheckPrepareInfo to assist in identifying the user session and the flow:
externalUserId(String, required) — User identifier within your system. Automatically hashed using SHA-256 before transmission.useCase(String, optional) — Identifier for the context or flow currently running. Transmitted in plain text.
_opener.openCameraSelfie(
listener: this,
webAppToken: token,
prepareInfo: UnicoCheckPrepareInfo(
externalUserId: 'external_user_id',
useCase: 'use_case', // optional
),
);
For the full result handling, see Receiving the result.