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.5Run the pub command to fetch the dependency:
flutter pub getNative 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
| Parameter | Type | Required | Description |
|---|---|---|---|
widgetKey | String | Yes | Your public SDK key from the Prembly dashboard. |
widgetId | String | Yes | The verification workflow configuration ID created in your dashboard. |
firstName | String | Optional | Pre-fills the user's first name in the verification form. |
lastName | String | Optional | Pre-fills the user's last name in the verification form. |
email | String | Optional | Pre-fills the user's email address. |
callback | Function | Yes | Function callback returning a Map containing status and session payload. |
Troubleshooting (Flutter)
- Build Failure on Android: Ensure your
compileSdkVersioninandroid/app/build.gradleis set to 33 or higher. - Camera Crash on iOS: Confirm that
NSCameraUsageDescriptionis present inInfo.plist. iOS terminates applications immediately if camera access is requested without a description string.