Skip to main content

flutter_validations_sdk 1.3.2 copy "flutter_validations_sdk: ^1.3.2" to clipboard
flutter_validations_sdk: ^1.3.2 copied to clipboard

retracted

Integrate Truora Digital Identity Validations into your Flutter app. Support for document validation and face recognition.

Truora Validations Flutter SDK #

Integrate Truora's Digital Identity Validations into your Flutter application.

Features #

  • Document Validation: Capture and validate government-issued IDs.
  • Face Recognition: Perform liveness checks and face matching.
  • Invoice Validation: Upload a utility bill (proof of address) via file picker or camera.
  • Easy Integration: Simple API to start the validation flow.

Getting started #

Add the dependency to your pubspec.yaml:

dependencies:
  flutter_validations_sdk: ^{version}

Android setup (required) #

The Android SDK requires the host activity to be a FragmentActivity. The default FlutterActivity generated by flutter create extends Activity directly and is not compatible — the plugin will refuse to initialize and start() will fail with:

ValidationHandler not available. The host MainActivity must extend FlutterFragmentActivity ...

Switch your MainActivity to FlutterFragmentActivity. This is a one-line change.

android/app/src/main/kotlin/.../MainActivity.kt:

package com.your.app

import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity : FlutterFragmentActivity()

FlutterFragmentActivity is provided by Flutter and is a drop-in replacement for FlutterActivity for any plugin that needs an AndroidX FragmentActivity host. No other changes are required (you don't need to switch your theme to Theme.AppCompat.* — the Truora flow uses its own internal AppCompat activity).

If you have a custom MainActivity (e.g. extending AppCompatActivity for legacy reasons), that also works — anything that extends androidx.fragment.app.FragmentActivity is accepted.

Usage #

import 'package:flutter_validations_sdk/flutter_validations_sdk.dart';

// Face
await TruoraValidationsSDK.initialize(InitializeConfig(
  getApiKeyFromSecureStorage: () async => await secureStorage.read('truora_key'),
  userId: 'user-123',
  validation: FaceConfig(FaceValidationConfig(useAutocapture: true)),
));

// Document
await TruoraValidationsSDK.initialize(InitializeConfig(
  getApiKeyFromSecureStorage: () async => apiKey,
  userId: 'user-123',
  validation: DocumentConfig(DocumentValidationConfig(
    country: Country.co,
    documentType: DocumentType.nationalId,
  )),
));

// Invoice
await TruoraValidationsSDK.initialize(InitializeConfig(
  getApiKeyFromSecureStorage: () async => apiKey,
  userId: 'user-123',
  validation: InvoiceConfig(InvoiceValidationConfig(country: Country.mx)),
));

final result = await TruoraValidationsSDK.start();

Updating native SDK versions #

iOS #

The iOS SDK version is pinned in ios/flutter_validations_sdk.podspec:

s.dependency "TruoraValidationsSDK", "{version}"

After bumping the version, run pod update (not pod install) in the sample app's iOS directory to unlock the old version from Podfile.lock:

cd flutter-app/validations_sample_app/ios
pod update TruoraValidationsSDK TruoraCamera

iOS add-to-app (native iOS host + Flutter module) #

If you embed a Flutter module inside a native iOS app (Flutter “add-to-app”), make sure the native host app installs the Flutter module’s plugins via CocoaPods (using the module’s .ios/Flutter/podhelper.rb).

Why: TruoraValidationsSDK ships iOS resources in a CocoaPods resource bundle named validations_TruoraValidationsSDK.bundle. CocoaPods copies that bundle into the final .app during the [CP] Copy Pods Resources build phase. If the host app does not run CocoaPods for the Flutter module/plugins (common when embedding only prebuilt frameworks), the bundle won’t be copied and iOS will crash with:

  • Fatal error: unable to find bundle named validations_TruoraValidationsSDK

If you must embed prebuilt frameworks #

If your integration embeds the Flutter module as prebuilt frameworks (e.g. flutter build ios-framework), you must ensure validations_TruoraValidationsSDK.bundle is included in the host app (e.g. “Copy Bundle Resources”) or switch to a CocoaPods-based add-to-app integration so the bundle is copied automatically.

Android #

The Android SDK versions are pinned in android/build.gradle:

implementation "com.truora:validations.face:{version}"
implementation "com.truora:validations.document:{version}"

Gradle resolves the new version automatically on the next build.

Regenerating the Pigeon bridge #

If any message classes in pigeons/messages.dart are modified, regenerate all platform files from the flutter_validations_sdk root:

dart run pigeon --input pigeons/messages.dart

This updates lib/src/messages.g.dart, android/.../Messages.g.kt, and ios/Classes/Messages.g.swift. Do not edit those files manually.

Additional information #

For more information, visit Truora Documentation.

0
likes
0
points
166
downloads

Publisher

verified publishertruora.com

Weekly Downloads

Integrate Truora Digital Identity Validations into your Flutter app. Support for document validation and face recognition.

Homepage

License

unknown (license)

Dependencies

flutter, pigeon

More

Packages that depend on flutter_validations_sdk

Packages that implement flutter_validations_sdk