Flutter SDK Reference
Every public class, property and method in the eKYC Flutter plugin. See Flutter SDK Integration for the integration guide.
CakeEkycPlugin
class CakeEkycPlugin
| Field | Type | Description |
|---|---|---|
initialize(config) | Future<Either<EkycFailure, bool>> | Initializes the plugin. Returns true on success. |
takeNID(config) | Future<Either<EkycFailure, NIDCardResult>> | Captures NID → uploads → checks sanity → checks tampering → extracts info. |
takeFaces(config) | Future<Either<EkycFailure, SelfieResult>> | Captures faces → uploads → checks sanity → checks liveness. |
upload(uploadImageRequests) | Future<Either<EkycFailure, List<EkycResponse<UploadImageResult>>>> | Uploads a list of images. |
checkNIDSanity({imageId, imageId2, cardType, specialTypeId}) | Future<Either<EkycFailure, EkycResponse<NIDSanityData>>> | Checks the sanity of an NID card. |
checkNIDTampering({imageId, imageId2, cardType, level}) | Future<Either<EkycFailure, EkycResponse<NIDTamperingData>>> | Checks for tampering on an NID card. |
readNIDInfo({imageId, imageId2, cardType}) | Future<Either<EkycFailure, EkycResponse<NIDCardData>>> | OCR the NID card. |
checkFaceSanity({imageId}) | Future<Either<EkycFailure, EkycResponse<FaceSanityData>>> | Checks the sanity of a face image. |
checkFaceLiveness({imageIds}) | Future<Either<EkycFailure, EkycResponse<FaceLivenessData>>> | Checks liveness of face images. |
compareFaces({imageId, imageId2}) | Future<Either<EkycFailure, EkycResponse<FaceComparingData>>> | Compares two face images. |
eventStream | Stream<EkycEvent> | Emits capture events while a flow runs. |
Results
NIDCardResult
Mirrors the Android and iOS shape: cardType, frontSideImage, backSideImage, qrData, sanityResult, tamperingResult, cardInfo.
SelfieResult
| Field | Type | Description |
|---|---|---|
faces | List<Face>? | Captured faces. |
sanityResults | List<EkycResponse<FaceSanityData>>? | Sanity response per face image. |
livenessResult | EkycResponse<FaceLivenessData>? | Liveness check result. |
Note this property is sanityResults (plural) in Flutter, versus sanityResult on Android and iOS.
Face
| Field | Type | Description |
|---|---|---|
image | EkycImage? | The portrait image. |
gesture | String | Face gesture: frontal, left, right, up, down. |
Configuration
Config
| Field | Type | Description |
|---|---|---|
languageCode | String | vi or en. |
baseUrl | String | Base URL for network requests. |
networkConfig | NetworkConfig | Network configuration settings. |
accessToken | AccessToken? | Authentication token provider. |
logger | Logger? | Log sink. |
exposeImage | bool? | Save images to local files. Defaults to false. |
NetworkConfig
| Field | Type | Description |
|---|---|---|
readTimeoutMilliSeconds | int | Read timeout, defaults to 0. |
writeTimeoutMilliSeconds | int | Write timeout, defaults to 0. |
connectTimeoutMilliSeconds | int | Connection timeout, defaults to 0. |
callTimeoutMilliSeconds | int | Total call time, defaults to 60000. |
Logger
| Field | Type | Description |
|---|---|---|
info(log) | void | Logs an informational message. |
error(log) | void | Logs an error message. |
warning(log) | void | Logs a warning message. |
TakeNIDConfig
| Field | Type | Description |
|---|---|---|
cardType | CardType | Card type, defaults to CardType.CCCD. |
cardSides | List<CardSide> | Sides to capture, defaults to [Front, Back]. |
requiredReview | bool | Require review, defaults to true. |
autoCaptureEnable | bool | Auto-capture once quality passes, defaults to true. |
requiredScanQR | bool | Require QR scanning, defaults to false. |
captureOnly | bool | Capture-only mode, defaults to false. |
otherSideImages | Map<CardSide, EkycImage> | The already-captured other side. |
TakeFaceConfig
| Field | Type | Description |
|---|---|---|
captureOnly | bool | Capture-only mode, defaults to false. |
Data Types
EkycImage
| Field | Type | Description |
|---|---|---|
id | String? | Unique identifier after uploading. |
label | String? | Label describing the image. |
file | String? | The image file. |
UploadImageRequest / UploadImageResult
| Field | Type | Description |
|---|---|---|
filePath | String? | Location of the image. |
label | String? | Label describing the image. |
metaData | String? | Upload metadata. |
imageId | String? | The image identifier after uploading. Result only. |
EkycResponse
| Field | Type | Description |
|---|---|---|
data | T? | The response data. |
error | List<EkycErrorDetail>? | Error details. |
code | int? | Response status code. |
message | String? | Response message. |
signature | String? | Response signature. |
signatureTimestamp | String? | Signature timestamp. |
rawData | String? | Raw data string. |
request | String? | The request. |
Unlike Android and iOS, the Flutter EkycResponse has no responseBody property.
EkycErrorDetail
| Field | Type | Description |
|---|---|---|
code | String? | Error code. |
message | String? | Error description. |
CardType / CardSide
| Field | Type | Description |
|---|---|---|
id | String | Card type identifier, e.g. vn.national_id. |
name | String | Card type name, e.g. id_card.vn.national_id. |
CCCD | static CardType | Vietnamese National ID. |
front back | CardSide | Front and back of the NID. |
NIDSanityData / CardSanity / NIDImageInfo
| Field | Type | Description |
|---|---|---|
status | String? | success or failure. |
cardSanity | CardSanity? | Card sanity details. |
image1 image2 | NIDImageInfo? | NID images used. |
requestId | String? | Request identifier. |
verdict | String? | good when the check passed. |
score | double? | Confidence score. |
info | String? | Additional information. |
id | String? | Image identifier. |
transformedImageId | String? | Transformed image identifier. |
cardBox | CardBox? | Card bounding box. |
NIDTamperingData / CardTampering / TamperingDetail
| Field | Type | Description |
|---|---|---|
status | String? | Status of the tampering check. |
cardTampering | CardTampering? | Tampering details. |
requestId | String? | Request identifier. |
imageId imageId2 | String? | Images used. |
verdict | String? | good when passed, otherwise the specific signal. |
score | double? | Confidence score. |
details | List<TamperingDetail>? | Individual tampering signals. |
NIDCardData / ExtractedData
| Field | Type | Description |
|---|---|---|
status | String? | Status of the extraction. |
extractedDataOnImage1 extractedDataOnImage2 | ExtractedData? | Data per image. |
cardInfo | List<CardInfo>? | Consolidated card information. |
requestId | String? | Request identifier. |
qr | QRData? | QR code data. |
ocr | OCRData? | OCR data. |
mrzData | MRZData? | MRZ data. |
QRData / OCRData / MRZData / ParsedField / CardInfo
| Field | Type | Description |
|---|---|---|
parsedFields | List<ParsedField>? | Parsed fields from this source. |
raw | String? | Raw value. QRData only. |
confidenceScore | double? | Confidence in the extraction. |
key | String? | Field name. |
value | String? | Field value. |
confidenceVerdict | String? | Confidence verdict. |
confidentScore | double? | Confidence score. CardInfo only. |
CardBox / Point
| Field | Type | Description |
|---|---|---|
topLeft topRight bottomLeft bottomRight | Point? | Corners of the card box. |
x y | double? | Point coordinates. |
FaceSanityData / PortraitSanity / PortraitImageInfo
| Field | Type | Description |
|---|---|---|
status | String? | Status of the face sanity check. |
portraitSanity | PortraitSanity? | Sanity details. |
requestId | String? | Request identifier. |
image | PortraitImageInfo? | Portrait image information. |
isSanityPassed() | bool | True when the verdict is good. |
verdict | String? | Outcome of the sanity check. |
score | double? | Confidence score. |
id | String? | Portrait image identifier. |
FaceLivenessData / LivenessResult
| Field | Type | Description |
|---|---|---|
status | String? | Status of the liveness check. |
isLive | bool? | Whether the face is live. |
score | double? | Confidence score. |
results | List<LivenessResult>? | Per-image results. |
requestId | String? | Request identifier. |
mainImageId | String? | Main image used. |
id | String? | Image identifier. Result only. |
FaceComparedData / ComparedResult
| Field | Type | Description |
|---|---|---|
status | String? | Status of the comparison. |
comparedResults | List<ComparedResult>? | Comparison results. |
requestId | String? | Request identifier. |
face1Id face2Id | String? | The compared face image ids. |
score | double? | Similarity score. |
result | String? | matched or not matched. |
INFO
compareFaces is declared to return EkycResponse<FaceComparingData> while the data class is named FaceComparedData. Treat them as the same type.
Events and Errors
EkycEvent
| Field | Type | Description |
|---|---|---|
id | int | Event identifier. |
params | Map<String, dynamic> | Event parameters. |
timestamp | int | Creation time in milliseconds. |
faceSelfieAssessingResultEvent | -1001 | Face selfie assessment result. |
nidAssessingResultEvent | -1003 | NID assessment result. |
nidCaptureStartedEvent | -1008 | NID capture started. |
nidCaptureEndedEvent | -1009 | NID capture ended. |
nidReviewStartedEvent | -1010 | NID review started. |
nidShuttleClickedEvent | -1011 | Shutter clicked. |
nidAutoCaptureSelectedEvent | -1012 | Auto-capture selected. |
nidReviewEndedEvent | -1013 | NID review finished. |
nidReviewAcceptClickedEvent | -1014 | Accept clicked. |
nidReviewDenyClickedEvent | -1015 | Deny clicked. |
faceCaptureStartedEvent | -1016 | Face capture started. |
faceCaptureEndedEvent | -1017 | Face capture ended. |
backBtnClickedEvent | -1018 | In-screen back button clicked. |
EkycFailure
| Field | Type | Description |
|---|---|---|
timeOutErrorCode | 40000 | Timeout. |
userCancelErrorCode | 40001 | User cancellation. |
permissionErrorCode | 40002 | Permission denial. |
cameraErrorCode | 40003 | Camera error. |
unexpectedErrorCode | 50000 | Unexpected error. |
nidSanityFailed | 60000 | NID sanity failure. |
nidTamperingFailed | 60001 | NID tampering failure. |
faceSanityFailed | 60002 | Face sanity failure. |
faceLivenessFailed | 60003 | Face liveness failure. |
code | String | The error code. |
message | String? | Error detail message. |
cause | Exception? | The underlying error. |
UI Setting Types
Passed through Config.uiSetting. See Flutter SDK § Customize UI.
| Field | Type | Description |
|---|---|---|
darkThemeSetting | EkycThemeSetting | Default theme for capture, QR and selfie screens. |
lightThemeSetting | EkycThemeSetting | Default theme for confirm and loading screens. |
nidCaptureScreenSetting | NIDCaptureScreenSetting | NID capture screen overrides. |
nidConfirmScreenSetting | NIDConfirmScreenSetting | NID confirm screen overrides. |
nidFeedbackLookupTable | NIDFeedbackLookupTable | Feedback message overrides for NID capture. |
scanQRScreenSetting | NIDScanQRScreenSetting | QR scanning screen overrides. |
selfieScreenSetting | SelfieScreenSetting | Selfie screen overrides. |
selfieFeedbackLookupTable | SelfieFeedbackLookupTable | Feedback message overrides for selfie capture. |
loadingScreenSetting | LoadingScreenSetting | Loading screen overrides. |
Next Steps
- Flutter SDK Integration — the integration guide
- Mobile SDK Overview — concepts shared across platforms