The plugin neurovision_kyc runs the session in the native SDKs (Android ru.neurovision.kyc:kyc-sdk, iOS NeuroVisionKyc); the result comes back to Dart.
Requirements
| Flutter |
| Android |
| iOS |
Installation
Until the plugin is on pub.dev, it comes in the SDK package: the plugin in sdk/flutter/neurovision_kyc/, the Android SDK it depends on in sdk/android/maven/.
1. Copy both folders into your project, e.g. as third_party/neurovision_kyc/ and third_party/neurovision-maven/.
2. pubspec.yaml:
dependencies:
neurovision_kyc:
path: third_party/neurovision_kyc 3. The Android SDK from the Maven folder — android/build.gradle.kts:
allprojects {
repositories {
maven {
url = uri(rootProject.projectDir.resolve("../third_party/neurovision-maven"))
content { includeGroup("ru.neurovision.kyc") }
}
google()
mavenCentral()
}
} rootProject.projectDir is your app's android/ folder. Keep it in the path: uri("…") alone in allprojects would resolve against each plugin's own folder.
4. flutter pub get.
The plugin carries the iOS framework: there is nothing else to fetch for iOS. Once the plugin is on pub.dev, the path: and the maven { … } block go.
Android
Set minSdk = 26 in android/app/build.gradle.kts.
The native SDK ships for arm64-v8a and armeabi-v7a. A Flutter app carries x86_64 libraries of its own, so on an x86_64 device or emulator it runs as x86_64 and the session does not start: start returns KycFailed(KycFailure.unsupportedDevice, …) at once — show the user that this device is not supported. Test on an arm64 emulator or a device.
MainActivity's launchMode. Flutter's template sets singleTop — keep it. With singleTask, if the user leaves the app during the session and comes back through the launcher icon, the session is lost (KycCancelled).
iOS
Set the Runner target's deployment target to 15.0 (platform :ios, '15.0' in the Podfile, if there is one) and add the camera usage text to Info.plist:
<key>NSCameraUsageDescription</key>
<string>The camera photographs your document and films the liveness check.</string> Usage
import 'package:neurovision_kyc/neurovision_kyc.dart';
import 'package:flutter/services.dart';
try {
final result = await NeuroVisionKyc.start(KycRequest(
apiHost: apiHost, // the address NeuroVision sent you
schemaId: schemaId,
clientKey: clientKey, // from your server
clientUser: userId, // optional: your user's id, the same in all their checks
language: 'en', // optional; default: the scenario's
theme: KycTheme.auto, // optional: auto | light | dark
));
// or: NeuroVisionKyc.start(KycRequest.task(apiHost: apiHost, taskId: taskId, clientUser: userId))
switch (result) {
case KycCompleted(:final verdict): // the server judged the session
print(verdict); // success | failed | suspicious | expired | unknown
case KycCancelled(): // the user left before the end
break;
case KycFailed(:final reason, :final message): // the session could not go on
print('$reason $message'); // cameraDenied | network | server | camera | config | unsupportedDevice | internal
}
} on PlatformException catch (e) {
// misuse, never a session's outcome:
// already_running | bad_request | no_activity (Android) | no_view_controller (iOS)
}
await NeuroVisionKyc.sdkVersion(); // the native SDK's version Every outcome of a session — a cancel, a refused camera, no network — is a KycResult, not an exception. Values a newer SDK may add are read as KycVerdict.unknown / KycFailure.internal.
What each result means and what to show the user — Results. Where the request's values come from — Server integration.
Refusals
PlatformException('already_running') |
PlatformException('bad_request') |
KycFailed(KycFailure.config, …) |
KycFailed(KycFailure.unsupportedDevice, …) |
Analytics (optional)
The SDK can send product analytics to the PostHog project your app names in its native settings; the SDK itself carries no key. Android — android/app/src/main/AndroidManifest.xml:
<application …>
<meta-data android:name="NeuroVisionKycPostHogKey" android:value="phc_…" />
<meta-data android:name="NeuroVisionKycPostHogHost" android:value="https://us.i.posthog.com" />
</application> iOS — ios/Runner/Info.plist:
<key>NeuroVisionKycPostHogKey</key>
<string>phc_…</string>
<key>NeuroVisionKycPostHogHost</key>
<string>https://us.i.posthog.com</string> Without a key the SDK sends no analytics. Keep the key out of git: manifest placeholders filled from android/gradle.properties, and $(KYC_POSTHOG_KEY) in Info.plist from a git-ignored .xcconfig. What is sent — Analytics and privacy.
Limits
- The session is a full-screen native screen (an Android activity, an iOS modal controller); it cannot be embedded in the widget tree.
- If Android kills the app's process while the session is on screen, the result is lost: the app restarts without the pending
Future.