Skip to main content

2. Initializing the SDK

2.1. Initializing

Before you can use the SDK, it must be initialized with the required settings. Here's how to do so:

final _metricSdk = MetricSdk();
_metricSdk.initMetricSdk(
SdkSettings(
appTheme: AppTheme(
appName: "YourAppName",
logoUrl: "https://upload.wikimedia.org/logo.svg.png",
primaryColor: Colors.deepPurple,
),
authenticator: ClientAuthenticator(
secretKey: "your_secret_key",
clientKey: "your_client_key",
),
environment: Environment.dev,
),
);

2.2. Launching the SDK

After initializing the SDK, you can start verifications using a generated token:

String result = await _metricSdk.launchSdk("Token");
info

2.3. Handling SDK Results

Once the SDK completes its process, it returns a result based on the verification outcome.

  • Verification successful: If the verification is successful, the SDK returns SUCCESS.
  • Verification failed: If the verification fails, one of the following results will be returned:
    • LIVENESS_FAILED
    • CANCELLED
    • INVALID_TOKEN
    • VERIFICATION_FAILED
    • UNAUTHORISED
    • UNKNOWN
info

Refer here for detailed explanations of each failure result.