This documentation is for version 1 of SDK. To view the in-progress documentation for upcoming version 2, see
Getting Started
Initialization and configuration


Before starting the video measurement, you'll need to initialize the SDK.

Under the hood that step verifies the license, connects to a native platform camera device and sets up rendering for real-time feedback. The app must have camera permissions before this step.

You'll need to provide an API key - see Authorization for more information.

API_KEY = ""
USER_ID = ""

final _initResult = await ShenaiSdk.initialize(API_KEY, USER_ID);

Error handling

You should check if the initialization was successful before proceeding further.

Possible errors at this stage include:

  • INVALID_API_KEY - the provided API key is malformed or inactive
  • CONNECTION_ERROR - there is a problem with network connection to the licensing server
  • INTERNAL_ERROR - other errors such as missing camera permissions

enum InitializationResult {

If the SDK has been successfully initialized, repeated calls to initialize will immediately return success - to start a new session first deinitialize the SDK.


The SDK can be configured at the initialization stage with certain functionalities turned on or off.

disableOverlayRendering (false by default) allows to hide the face mesh/blood visualization isCameraPreviewMirror (true by default) determines if the camera preview is displayed in mirrored mode

final _initResult = await ShenaiSdk.initialize(API_KEY, USER_ID,
    disableOverlayRendering: true,
    isCameraPreviewMirror: true

Connecting the rendering surface

Initializing the SDK creates a rendering target for displaying the camera preview, optionally including a 3d mask preview and real-time blood pulsation visualization.

Obtain the rendering texture identifier from the SDK:

final _displayTexture = await ShenaiSdk.createDisplayTexture();

You can then render it in the Flutter tree using the Texture widget.

Texture(textureId: _displayTexture)


After finishing using the SDK you should deinitialize it - that will free up any allocated resources and disconnect from the camera.