Flutter SDK Guide

The official prembly_identity_kyc package for Flutter allows you to launch identity verification, biometric capture, and liveness challenges across iOS, Android, and Web apps using native Dart bindings.


Installation

Add the package to your project's pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  prembly_identity_kyc: ^0.0.5

Run the pub command to fetch the dependency:

flutter pub get

Native Platform Permissions Setup

iOS Configuration (ios/Runner/Info.plist)

Open ios/Runner/Info.plist and append the camera permission key:

<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera for identity document scanning and biometric liveness verification.</string>

iOS Simulator Limitation

The camera hardware module is unavailable on iOS Simulators. Always test identity verification and face liveness flows on a physical iOS device.

Android Configuration (android/app/src/main/AndroidManifest.xml)

Open android/app/src/main/AndroidManifest.xml and add:

<uses-permission android:name="android.permission.CAMERA" />

Implementation Example

Import the library and invoke PremblyIdentityKyc.verify() with your IdentityKycOptions:

import 'package:flutter/material.dart';
import 'package:prembly_identity_kyc/prembly_identity_kyc.dart';

class IdentityVerificationScreen extends StatelessWidget {
  const IdentityVerificationScreen({Key? key}) : super(key: key);

  void startVerification(BuildContext context) {
    PremblyIdentityKyc.verify(
      context: context,
      options: IdentityKycOptions(
        widgetKey: 'wk_live_abc123xyz789',
        widgetId: '550e8400-e29b-41d4-a716-446655440000',
        firstName: 'John',
        lastName: 'Doe',
        email: 'john@example.com',
        callback: (response) {
          debugPrint('Prembly Response: $response');
          
          if (response['status'] == 'success') {
            ScaffoldMessenger.of(context).showSnackBar(
              const SnackBar(content: Text('Identity Verified Successfully!')),
            );
          } else {
            ScaffoldMessenger.of(context).showSnackBar(
              const SnackBar(content: Text('Verification Closed or Failed')),
            );
          }
        },
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Identity Verification')),
      body: Center(
        child: ElevatedButton(
          onPressed: () => startVerification(context),
          child: const Text('Verify Identity'),
        ),
      ),
    );
  }
}

IdentityKycOptions Parameter Reference

ParameterTypeRequiredDescription
widgetKeyStringYesYour public SDK key from the Prembly dashboard.
widgetIdStringYesThe verification workflow configuration ID created in your dashboard.
firstNameStringOptionalPre-fills the user's first name in the verification form.
lastNameStringOptionalPre-fills the user's last name in the verification form.
emailStringOptionalPre-fills the user's email address.
callbackFunctionYesFunction callback returning a Map containing status and session payload.

Troubleshooting (Flutter)

  • Build Failure on Android: Ensure your compileSdkVersion in android/app/build.gradle is set to 33 or higher.
  • Camera Crash on iOS: Confirm that NSCameraUsageDescription is present in Info.plist. iOS terminates applications immediately if camera access is requested without a description string.