• About TrustVision
  • Android SDK
  • iOS SDK
  • Flutter SDK
  • React Native SDK
  • Web SDK
  • API Client Libraries
  • Integration Case Studies
  • TS eKYC/FA App
TrustVision API Documentation

Flutter 4.x.x

Environment

Flutter

Flutter SDK ">=2.12.0 <3.0.0"

iOS

iOS 11 and above

Xcode "16.0"

Android

  • Gradle Version 7.2.2
  • Tested with Gradle Plugin for Android Studio - version Android Studio Electric Eel | 2022.1.1 Patch 2
  • minSdkVersion 21
  • targetSdkVersion 33

Installation

Common

1. Add Trust Vision Flutter lib

Add to pubspec.yaml file under dependencies group:

  trust_vision_plugin:
    git:
     # Replace the below with your specific info
      url: to_be_replaced
      ref: to_be_replaced

2. Precompile

$ flutter pub get

iOS

1. Add to podfile

# Add below lines to the end of podfile
post_install do |installer|
    installer.pods_project.targets.each do |target|
        // you can add more modules which have the error "Undefined symbol" into the list
        if ['CocoaLumberjack', 'TensorFlowLiteC', 'TensorFlowLiteSwift', 'PromiseKit', 'lottie-ios', 'OpenSSL-Universal','CryptoSwift'].include? "#{target}"
            target.build_configurations.each do |config|
                config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
                config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
            end
        end
    end
end

2. Setup Xcode

Set Build Libraries for Distribution in Build Settings to No

alt text

3. Precompile

$ pod install

Android

Add to root-level build.gradle file (host app):

groovy
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

allprojects {
    repositories {
        google()
        mavenCentral()

        /*
        Replace the below with your path to `trust_vision_plugin` Android repo which downloaded by `flutter pub get`.
        */
        maven { url "$flutterRoot/.pub-cache/git/replace_by_git_repo_name-replace_by_commit_hash/android/repo" }
        /*
        For example:
        maven { url "$flutterRoot/.pub-cache/git/tv_flutter_sdk_xyz-1a5eb61ccb44ffafa4d3557f4d9d8087bc1a4666/android/repo" }
        */
    }
}

Add to app/build.gradle:

groovy
aaptOptions {
    noCompress "tflite"
    noCompress "lite"
}

Usage

dart
import 'package:trust_vision_plugin/trust_vision_plugin.dart';

2. Start the SDK

The SDK provides some built in Activities example activity to eKYC journey.

2.1. eKYC Platform

2.1.1. eKYC Platform Configuration

dart

    Map<String, dynamic> config = {
        "token": "your_token",
        "baseUrl": "your_url",
        "language" : "en" ,
        "flowId: "your_value"
        "enableSound: true,
        "cardTypes": "your_value",
        "singleStep" : "your_value"
      };

Where:

  • token: String This is the authentication token required to call the eKYC platform API within the SDK. Obtain this token from TrustingSocial eKYC Platform.
  • baseUrl: String The base URL for the eKYC platform API. This is also provided by TrustingSocial eKYC Platform.
  • language: String?, that specifies the language for SDK display. Set this to your preferred language code (e.g., "en" for English, "vi" for Vietnamese)
  • isEnableSound: bool that enables or disables guiding sound during the eKYC process. Set to true to enable sound or false to disable it
  • flowId : String?, that identifies the specific eKYC flow you want to execute. Choose from the following options:
- ID → Selfie: flowId=id_selfie
- Selfie → ID: flowId=selfie_id
- ID → NFC → Selfie: flowId=id_nfc_selfie
- QR → NFC → Selfie: flowId=qr_nfc_selfie
  • cardType: TVCardType? object that specifies the type of card being used in the eKYC process. The card type is defined as follows:

  • singleStep : String?, Optional Single Step mode:

ValueDescription
"ekyc.id_card"Only ID Card capture
"ekyc.selfie"Only Selfie capture
dart
TVCardType cardType = TVCardType(
  id: "vn.national_id",
  name: "CMND cũ / CMND mới / CCCD / Hộ chiếu",
  hasBackSide: true,
  orientation: TVCardOrientation.HORIZONTAL,
);

2.1.2. Start eKYC Platform

dart
  void startEKYCPlatformNative() async {

    try {
      Map<String, dynamic> config = {
        "token": token,
        "baseUrl": url,
        "language" : "en",
      };

      String? result = await TrustVisionPlugin.instance
          .starteYKCPlatform(configurations: config);
      if (result != null) {
         // Handle successfull
      }
    } catch (e) {
      // Handle error
    }
  }

2.2. eKYC Platform in webview mode

Dart
final url =  "your_url"
try {
      String? result =
          await TrustVisionPlugin.instance.starteYKCPlatformWebview(url: url);
      if (result != null) {
        // Handle successfull
      }
    } catch (e) {
      // Handle error
    }