Plugin Response
Plugin response example
The method returns a JSON string containing the response state and result data. Parse the response to handle different outcomes:
final resultJson = await VIDVDocKit().start(args);
if (resultJson != null) {
final response = json.decode(resultJson);
final state = response['state'];
switch (state) {
case 'SUCCESS':
// Handle successful capture
break;
case 'EXIT':
// Handle user cancellation
break;
case 'ERROR':
// Handle configuration error
break;
case 'FAILURE':
// Handle service failure
break;
}
}
🔁 VIDVDocKitResponse Types
Type
Description
Code example
Success(data)
When the document is successfully captured and processed, the response contains the extracted data and captured images.
{
"state": "SUCCESS",
"result": {
"data": {
"captures": {
"front": "base64_encoded_
image...",
"back": "base64_encoded_
image..."},
"extractedData": {
"first_name": "John",
"last_name": "Doe",
"birth_date": "1990-01-01",
"national_id": "123456234",
"gender": "M",
"address": "123 X Street"}
},
"sessionID": "abc123-def456",
"hmacData": "..."}}
Error(code, message)
Returned when there is a configuration or builder error. This typically indicates an issue with the provided parameters.
{
"state": "ERROR",
"code": "INVALID_CONFIG",
"message": "Missing required parameter: access_token"}
ServiceFailure(code, message, data)
Returned when a service or network failure occurs during processing.
{
"state": "FAILURE",
"code": "SERVICE_ERROR",
"message": "Unable to connect to the server",
"result": {
"data": {
"captures": { ... }
}}}
Exit(step, data)
Returned when the user cancels the capture flow. May contain partial data if the user exited after some captures
{
"state": "EXIT",
"step": "capture_front",
"result": {
"data": {
"captures": { ... },
"extractedData": null}
}}
📦 VIDVDocKitData
Field
Type
Description
sessionID
String
Unique session ID
hmacData
String
HMAC signature for data verification (if enabled)
captures
Map<String,String?>
Document images in Base64
extractedData
Map<String,String?>
Extracted values from document
🖼 Captures
🧾ExtractedData
Last updated