prembly_kyc 0.1.2+3 copy "prembly_kyc: ^0.1.2+3" to clipboard
prembly_kyc: ^0.1.2+3 copied to clipboard

A Flutter widget for Prembly/IdentityPass KYC verification. Presents a draggable bottom sheet with an embedded WebView for seamless identity verification.

Prembly Kyc #

style: very good analysis Powered by Mason License: MIT

A Flutter widget for Prembly/IdentityPass KYC verification. Presents a beautiful, Intercom-style draggable bottom sheet with an embedded WebView for seamless identity verification.

Features #

  • Automatic camera permission handling
  • Clean callback API for success, error, and cancellation
  • Automatic widget initialization via Prembly API
  • iOS and Android support

Installation #

Add prembly_kyc to your pubspec.yaml:

dependencies:
  prembly_kyc: ^0.1.0

Then run:

flutter pub get

Platform Configuration #

Android #

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
</manifest>

iOS #

Add the following to your ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera access is required for identity verification</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app may requires access to your location to complete verification</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Allow access to your phone's location for verification</string>

Prerequisites #

Before using this package, you need to:

  1. Create an account on Prembly Dashboard
  2. Create a widget and get your widgetId and widgetKey

Usage #

Basic Usage #

import 'package:prembly_kyc/prembly_kyc.dart';

// In your widget
ElevatedButton(
  onPressed: () async {
    await PremblyKyc(
      config: PremblyConfig(
        widgetId: 'your_widget_id',
        widgetKey: 'wdgt_your_widget_key',
        email: 'user@example.com',
        firstName: 'John',
        lastName: 'Doe',
      ),
      onSuccess: (response) {
        print('Verified via ${response.channel}');
        print('Data: ${response.data}');
      },
      onError: (error) {
        print('Error: ${error.message}');
        if (error.isPermissionError) {
          // Show permission settings dialog
        }
      },
      onClose: () {
        print('Widget closed');
      },
    ).show(context);
  },
  child: Text('Verify Identity'),
)

With Extra Metadata #

You can include additional metadata with the verification:

PremblyKyc(
  config: PremblyConfig(
    widgetId: 'your_widget_id',
    widgetKey: 'wdgt_your_widget_key',
    firstName: 'John',
    lastName: 'Doe',
    email: 'user@example.com',
    metadata: {
      'user_id': 'user_123',
      'source': 'mobile_app',
      'custom_field': 'your_value',
    },
  ),
  // ...callbacks
).show(context);

API Reference #

PremblyConfig #

Property Type Required Description
widgetId String Yes Your Prembly widget ID
widgetKey String Yes Your Prembly widget key (format: wdgt_xxx...)
email String Yes User's email address
firstName String Yes User's first name
lastName String Yes User's last name
metadata Map<String, dynamic>? No Additional data to include

PremblyResponse #

Returned on successful verification:

Property Type Description
status String "success"
code String "00" for success
message String Success message
channel String Verification type (e.g., "BVN", "NIN")
data Map<String, dynamic>? Verification data

PremblyError #

Returned on errors:

Property Type Description
type PremblyErrorType Type of error
message String Error message
code String? Error code (e.g., "E01", "E02")
isCancelled bool Whether user cancelled
isPermissionError bool Whether it's a permission issue

Error Types #

enum PremblyErrorType {
  cameraPermissionDenied,
  cameraPermissionPermanentlyDenied,
  locationPermissionDenied,
  initializationFailed,
  cancelled,
  verificationFailed,
  networkError,
  webViewError,
  unknown,
}

How It Works #

  1. Permission Check: Requests camera and location permission if not already granted
  2. Display: Shows a modal bottom sheet with the Prembly verification UI
  3. Verification: User completes the verification flow
  4. Callback: Returns the result via onSuccess or onError callbacks

Closing the Widget #

Users can close the verification widget via:

  • The X button in the Prembly widget (if redirect URL is configured in dashboard)
  • Dragging down on the handle
  • The "Cancel" button at the bottom
  • System back button/gesture

Webhook Integration #

For production use, configure your webhook URL in the Prembly dashboard to receive verification results on your backend. This ensures you have a server-side record of all verifications.

Contributing #

Contributions are welcome!

Credits #

Built with ❤️ by Mubharaq

0
likes
150
points
5
downloads

Documentation

API reference

Publisher

verified publishermubharaq.dev

Weekly Downloads

A Flutter widget for Prembly/IdentityPass KYC verification. Presents a draggable bottom sheet with an embedded WebView for seamless identity verification.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, flutter_inappwebview, permission_handler

More

Packages that depend on prembly_kyc