Flutter API

Classes

FaceCapture

Library object that manages all other Face Capture API classes.

Face Capture Create

Description: Create a FaceCapture object.

Function Definition:

FaceCapture();

Returns: A new FaceCapture object.

Workflow Create

Description: Create a Workflow object using a workflow name. The Workflow object will become invalid if the FaceCapture used to create it is destroyed.

Function Definition:

Workflow workflowCreate(String workflowName)
WorkflowCreateParameters:
Parameter Name Parameter Type Description
workflowName String Name of the workflow to create

Returns: A new Workflow object.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • UNKNOWN_WORKFLOW - The workflowName specified did not match any of the valid workflow names. Please see the Constants section for the list of valid names.

Get Camera List

Description: Get a list of available Camera objects. Use CameraPosition.front to get all “selfie”/front facing cameras. Use CameraPosition.back to get all cameras on the back of the device.

Function Definition:

List getCameraList(CameraPosition cameraPosition)
getCameraListParameters:
Parameter Name Parameter Type Description
cameraPosition CameraPosition Position of the cameras on the device

Returns: An array of Cameras for the camera position specified.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAMERA_POSITION - The position value specified was not a valid CameraPosition.

Start Capture Session

Description: Start a capture session using the specified Workflow and Camera. While capturing, you cannot modify either object until the capture session ends. A capture session can end via a stopCaptureSession() call, if the capture session timeout expires, if there is a hardware issue, or if it captures successfully. A successful capture session will store data in the Workflow which can be retrieved with functions like getCapturedImage() and getServerPackage().

Function Definition:

void startCaptureSession(Workflow workflow, Camera camera)
startCaptureSessionParameters:
Parameter Name Parameter Type Description
workflow Workflow Workflow containing settings for the capture session
camera Camera Camera to be used in the capture session

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_WORKFLOW - The Workflow object has been invalidated by dispose() and cannot be used.
  • INVALID_CAMERA - The Camera object has been invalidated by dispose() and cannot be used.
  • NO_CAPTURE_PROFILE - The captureProfile WorkflowProperty was not specified. A valid captureProfile must be set.
  • INVALID_CAPTURE_PROFILE - The captureProfile WorkflowProperty specified was not profile valid XML.

Stop Capture Session

Description: Stop the current capture session. If there is no capture session running, this is a no-op. This will cause the CaptureSessionStatus.stopped code to return from the next CaptureState’s getStatus() call. The next CaptureState’s getFrame() functions will throw the CAPTURE_SESSION_UNAVAILABLE error.

Function Definition:

void stopCaptureSession()

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.

Capture Session Get Capture Region

Description: Function that retrieves the region of interest. The region of the image where the face will be captured. This can only be called after starting a capture session while the capture session is running.

Function Definition:

Rectangle getCaptureSessionRoi()

Returns: A rectangle defining the area of interest. The area where the face will be captured. The rectangle is defined by a point (x,y) at the upper left corner along with a width and height.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCaptureJNI object has been invalidated by dispose() and cannot be used.
  • CAPTURE_SESSION_UNAVAILABLE - There are no capture sessions currently running

Capture Session Enable Autocapture

Description: Enable or disable the autocapture for the capture session. This can only be called after starting a capture session while the capture session is running.

Function Definition:

void captureSessionEnableAutocapture(enable_autocapture)
functionParameters:
Parameter Name Parameter Type Description
enableAutocapture bool Boolean value to enable or disable autocapture

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • CAPTURE_SESSION_UNAVAILABLE - There are no capture sessions currently running.

Get Capture Session State

Description: Blocking function that retrieves the capture session state object.

Function Definition:

CaptureState getCaptureSessionState()

Returns: A new CaptureState object.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.

Get Server Package

Description: Get the JSON server package as a string value. The Workflow specified must have been used to start a successful capture session.

Function Definition:

String getServerPackage(Workflow workflow, PackageType packageType)
functionParameters:
Parameter Name Parameter Type Description
workflow Workflow Workflow containing settings for the capture session
packageType PackageType Type of JSON request package

Returns: The string representation of the JSON server package.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCaptureJNI object has been invalidated by dispose() and cannot be used.
  • CAPTURE_SESSION_UNAVAILABLE - There are no capture sessions currently running.
  • INVALID_PACKAGE_TYPE - The packageType specified was invalid.

Get Encrypted Server Package

Description: Get the encrypted JSON server package as a string value. The Workflow specified must have been used to start a successful capture session.

Function Definition:

String getEncryptedServerPackage(encryption_type, encryption_key, workflow_obj, package_type)
functionParameters:
Parameter Name Parameter Type Description
encryptionType EncryptionType Type of encryption
encryptionKey String String containing encryption key
workflow Workflow Workflow object containing settings for the capture session
packageType PackageType Type of JSON request package

Returns: The string representation of the encrypted JSON server package.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • CAPTURE_SESSION_UNAVAILABLE - There are no capture sessions currently running.
  • INVALID_PACKAGE_TYPE - The PackageType specified was invalid.
  • INVALID_ENCRYPTION_TYPE - The EncryptionType specified was invalid.
  • INVALID_ENCRYPTION_PUBLIC_KEY - The encryptionKey specified was invalid.

Get Captured Image

Description: Get the image that was captured by a capture session. The Workflow specified must have been used to start a successful capture session.

Function Definition:

Uint8List getCapturedImage(Workflow workflow)
functionParameters:
Parameter Name Parameter Type Description
workflow Workflow Workflow object containing the settings from a successful capture session

Returns: The frame captured and included in the server package.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • CAPTURE_SESSION_UNAVAILABLE - The Workflow specified has not been used in a successful capture session.
  • INVALID_WORKFLOW - The Workflow object has been invalidated by dispose() and cannot be used.

Get Version

Description: Get the Face Capture SDK version as an integer value.

Function Definition:

int getVersion()

Returns: The integer representation of the Face Capture SDK version in AABBCCDD format.

  • AA is the major version
  • BB is the minor version
  • CC is the bug fix version
  • DD is the build version

Throws: None

Get Version String

Description: Get the Face Capture SDK version as a string value.

Function Definition:

String getVersionString()

Returns: The string representation of the Face Capture SDK version.

Throws: None

Dispose

Description: Dispose the FaceCapture object. This will free the memory used by the native library. Calling dispose will invalidate this object and all objects created by it. Attempting to use any functions with this or any other invalidated object will result in the NULL_FACE_CAPTURE_OBJ error being thrown.

Function Definition:

void dispose()

Returns: None

Throws: None

CaptureState

The Capture State object provides a snap-shot of the capture session’s state when created. The data provided by a single Capture State will never change. A new Capture State must be retrieved in order to get a new status update from the capture session.

Get Status

Description: Function that retrieves the capture session’s status from when the Capture State was created.

Function Definition:

CaptureSessionStatus getStatus()

Returns: The capture session status from when the Capture State was created. See the CaptureSessionStatus enumeration descriptions for details.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAPTURE_STATE - The CaptureState object has been invalidated by dispose() and cannot be used.

Get Frame

Description: Function that retrieves the preview frame from when the Capture State was created.

Function Definition:

Uint8List getFrame()

Returns: A Base64 encoded string containing a preview frame from the capture session. The frame is in JPG format. The frame is either 480x640 in portrait mode or 640x480 in landscape mode.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAPTURE_STATE - The CaptureState object has been invalidated by dispose() and cannot be used.
  • NO_FRAME_AVAILABLE - The capture session ended before the next frame was ready. There is no frame available for this Capture State.

Get Feedback

Description: Function that retrieves the subject feedback from when the Capture State was created.

Function Definition:

AutoCaptureFeedback getFeedback()

Returns: The most recent AutoCaptureFeedback update when the Capture State was created. See the AutoCaptureFeedback enumeration descriptions for more details.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAPTURE_STATE - The CaptureState object has been invalidated by dispose() and cannot be used.

Dispose

Description: Destroys the CaptureState object. This will free the memory used by the native library. Calling destroy will invalidate this object. Attempting to use any functions with an invalidated CaptureState will result in the INVALID_CAPTURE_STATE error being thrown.

Function Definition:

void dispose()

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAPTURE_STATE - The CaptureState object has been invalidated by dispose() and cannot be used.

Workflow

Workflow object used to store capture session configurations.

Set Property Double

Description: Set a double property value for the specified workflow property. Attempting to set a non-double property will result in a WORKFLOW_PROPERTY_TYPE_MISMATCH error being thrown. See the WorkflowProperty enumeration descriptions for more details.

Function Definition:

void setPropertyDouble(WorkflowProperty workflowProperty, double value)
functionParameters:
Parameter Name Parameter Type Description
workflowProperty WorkflowProperty Workflow property having its value set
value double New value for the specified workflow property

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_WORKFLOW - The Workflow object has been invalidated by dispose() and cannot be used.
  • INVALID_WORKFLOW_PROPERTY - The property value was not a valid WorkflowProperty.
  • WORKFLOW_PROPERTY_TYPE_MISMATCH - The property value specified does not accept a double value.

Set Property String

Description: Set a string property vlaue for the specified workflow property. Attempting to set a non-string property will result in a WORKFLOW_PROPERTY_TYPE_MISMATCH error being thrown. See the WorkflowProperty enumeration descriptions for more details.

Function Definition:

void setPropertyString(WorkflowProperty workflowProperty, String value)
functionParameters:
Parameter Name Parameter Type Description
workflowProperty WorkflowProperty Workflow property having its value set
value String New value for the specified workflow property

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_WORKFLOW - The Workflow object has been invalidated by dispose() and cannot be used.
  • INVALID_WORKFLOW_PROPERTY - The property value was not a valid WorkflowProperty.
  • WORKFLOW_PROPERTY_TYPE_MISMATCH - The property value specified does not accept a String value.

Dispose

Description: Dispose the Workflow object. This will free the memory used by the native library. Calling dispose will invalidate this object. Attempting to use any functions with this invalidated Workflow will result in the NULL_FACE_CAPTURE_OBJ or INVALID_WORKFLOW error being thrown.

Function Definition:

void dispose()

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_WORKFLOW - The Workflow object has been invalidated by dispose() and cannot be used.

Camera

Camera object used to store capture session configurations.

Get Name

Description: Get the name of the Camera.

Function Definition:

String getName()

Returns: String containing the name of the Camera.

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAMERA - The Camera object has been invalidated by dispose() and cannot be used.

Set Orientation

Description: Set the orientation of the camera. This will affect how the capture session expects the camera to be oriented. See the CameraOrientation enumeration descriptions for more details.

Function Definition:

void setOrientation(CameraOrientation cameraOrientation)
functionParameters:
Parameter Name Parameter Type Description
cameraOrientation CameraOrientation New camera orientation for this camera to be used in capture sessions

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAMERA - The Camera object has been invalidated by dispose() and cannot be used.
  • INVALID_CAMERA_ORIENTATION - The orientation specified was not a valid CameraOrientation.
  • CAMERA_IN_USE - The Camera is currently in use in a capture session and cannot be modified.

Dispose

Description: Dispose the Camera object. This will free the memory used by the native library. Calling dispose will invalidate this object. Attempting to use any functions with an invalidated Camera will result in the NULL_FACE_CAPTURE_OBJ or INVALID_CAMERA error being thrown.

Function Definition:

void dispose()

Returns: None

Throws:
  • NULL_FACE_CAPTURE_OBJ - The FaceCapture object has been invalidated by dispose() and cannot be used.
  • INVALID_CAMERA - The Camera object has been invalidated by dispose() and cannot be used.