ComplyCube Flutter SDK
The official Flutter SDK for integrating ComplyCube's Identity Verification UI into your mobile app.
ComplyCube enables you to automate your AML/KYC workflows effortlessly.
Documentation and minimum requirements can be found at docs.complycube.com/documentation/guides/mobile-sdk-guide.
Installation
Install the SDK
Install the Flutter library by running:
flutter pub add complycube
CocoaPods
-
Before using the ComplyCube SDK, install the CocoaPods plugin by running the following command in your terminal:
sudo gem install cocoapods -
Open your
ios/Podfileand add the following configuration:source 'https://github.com/CocoaPods/Specs.git' platform :iOS, '13.0' target 'YourApp' do use_frameworks! use_modular_headers! # Other existing pod configurations post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |build_configuration| build_configuration.build_settings['ENABLE_BITCODE'] = 'NO' build_configuration.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.1' build_configuration.build_settings['ARCHS'] = ['$(ARCHS_STANDARD)', 'x86_64'] build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = ['arm64', 'arm64e', 'armv7', 'armv7s'] build_configuration.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES' end end end $static_frameworks = [ # pods that must be built statically ] pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} installer.pod_targets.each do |target| if $static_frameworks.include?(target.name) puts "Overriding the static_framework method for #{target.name}" def target.build_type; Pod::BuildType.static_library end end end end end -
Save the
Podfile. -
Run
pod installin youriosdirectory to install the pods and apply the configurations.
Application Permissions
Our SDK uses the device camera and microphone for capture. You must add the following keys to your application's ios/Info.plist file.
-
NSCameraUsageDescription<key>NSCameraUsageDescription</key> <string>Used to capture facial biometrics and documents</string> -
NSMicrophoneUsageDescription<key>NSMicrophoneUsageDescription</key> <string>Used to capture video biometrics</string>
Enable NFC document reading (iOS, optional)
The SDK ships two CocoaPods variants — the default (no NFC) and an NFC-enabled variant. NFC is opt-in; enable it only if your workflow reads ePassports or eMRTD-compliant ID chips.
-
Pin the NFC variant of the SDK pod. Add the explicit dependency to your app's
ios/Podfile, inside thetargetblock:target 'Runner' do use_frameworks! use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) # Pull the NFC-enabled variant of the ComplyCube iOS SDK. pod 'ComplyCubeMobileSDK', '2.0.12-nfc' endThen run
pod install --repo-updatein yourios/directory. -
Add the Near Field Communication Tag Reading capability in Xcode: open your workspace → select the app target → Signing & Capabilities → + Capability → Near Field Communication Tag Reading. Xcode will generate the entitlements file and register the capability with your provisioning profile (your Apple Developer team's App ID must have NFC enabled).
-
Add the NFC usage description and reader identifiers to your
ios/Runner/Info.plist:<key>NFCReaderUsageDescription</key> <string>Used to read your passport or ID chip for identity verification.</string> <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <array> <string>A0000002471001</string> <string>A0000002472001</string> <string>00000000000000</string> </array> -
Opt in to NFC in your workflow configuration when calling
ComplyCube.start(settings). Enable the flag on the document-capture stage:final settings = { 'stages': [ { 'name': 'documentCapture', 'documentTypes': ['passport'], 'nfcEnabled': true, }, // ...other stages ], // ...other settings };
NFC requires a physical device (iPhone 7 or newer) — it will not function in the iOS Simulator.
Android
Our SDK is available on Maven Central.
Update your application's android/build.gradle file with the ComplyCube SDK repository Maven settings and SDK dependency:
repositories {
mavenCentral()
}
dependencies {
implementation "com.complycube:complycube-sdk:+"
}
Getting Started
Visit our step-by-step guide to quickly get started with our SDK.
Usage
The SDK exposes a single entry point, ComplyCube, with two pieces:
ComplyCube.start(settings)— launches the native verification flow. The returnedFutureresolves once the flow has been handed off to the native layer (or with a validation error). It does not carry the final result.ComplyCube.events— a broadcastStream<ComplyCubeEvent>that emits the actual outcomes (ComplyCubeSuccess,ComplyCubeError,ComplyCubeCancelled,ComplyCubeCustom). Subscribe to this before callingstart.
Setting up listeners
Subscribe to ComplyCube.events once (e.g. in initState) and remember to
cancel the subscription in dispose:
import 'dart:async';
import 'package:complycube/complycube.dart';
import 'package:flutter/material.dart';
class MyVerificationPage extends StatefulWidget {
const MyVerificationPage({super.key});
@override
State<MyVerificationPage> createState() => _MyVerificationPageState();
}
class _MyVerificationPageState extends State<MyVerificationPage> {
StreamSubscription<ComplyCubeEvent>? _sdkEventsSub;
@override
void initState() {
super.initState();
_sdkEventsSub = ComplyCube.events.listen(
_handleSdkEvent,
onError: (Object error, StackTrace stackTrace) {
debugPrint('ComplyCube stream error: $error');
},
);
}
@override
void dispose() {
_sdkEventsSub?.cancel();
super.dispose();
}
void _handleSdkEvent(ComplyCubeEvent event) {
if (event is ComplyCubeSuccess) {
// event.payload contains the workflow response, e.g.:
// { "documentIds": ["..."], "livePhotoIds": ["..."], "poaIds": ["..."] }
debugPrint('Success: ${event.payload}');
} else if (event is ComplyCubeError) {
debugPrint('Error: code=${event.code}, message=${event.message}');
} else if (event is ComplyCubeCancelled) {
debugPrint('Cancelled: code=${event.code}, reason=${event.reason}');
} else if (event is ComplyCubeCustom) {
debugPrint('Custom event: ${event.event}');
}
}
Future<void> _launchFlow() async {
final settings = <String, dynamic>{
'token': 'YOUR_SDK_TOKEN',
'environment': ComplyCubeEnvironment.live.name, // 'live' | 'test' | 'preview'
'workflowTemplateId': 'YOUR_WORKFLOW_TEMPLATE_ID',
// Or supply 'stages': [...] / 'workflowDefinition': {...} instead.
};
final launchResult = await ComplyCube.start(settings);
if (launchResult is ComplyCubeError) {
// Launch-time validation failed; final flow outcomes still arrive via the stream above.
debugPrint('Launch rejected: ${launchResult.message}');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: _launchFlow,
child: const Text('Start verification'),
),
),
);
}
}
ComplyCubeSuccess.payload
For the default flow (Identity Document + Live Photo + Proof of Address), the
payload is a map shaped like:
{
'documentIds': ['...'],
'livePhotoIds': ['...'],
'poaIds': ['...'],
}
The exact keys depend on which stages your workflow runs.
More Documentation
Our Mobile SDK integration documentation and code examples can be found at docs.complycube.com/documentation/guides/mobile-sdk-guide.
Our sample Flutter Mobile SDK project can be found at github.com/complycube/complycube-flutter-sdk.
Further information on ComplyCube can be found at www.complycube.com.
CI/CD & Release Automation
For details on the GitHub Actions workflows, release scripts, required secrets, and the developer workflow for cutting releases, see CI_CD.md.
Libraries
- complycube
- The official ComplyCube Flutter SDK.