digilocker_flutter_sdk 1.0.1
digilocker_flutter_sdk: ^1.0.1 copied to clipboard
A Flutter plugin wrapper for Surepass DigiLocker SDK with compiled binaries (AAR/Framework)
DigiLocker Flutter SDK #
A Flutter plugin wrapper for Surepass DigiLocker SDK with compiled binaries (AAR/Framework). This SDK provides a thin Flutter wrapper over the native Android and iOS SDKs, allowing you to integrate DigiLocker verification seamlessly into your Flutter apps.
Architecture #
This SDK follows a wrapper pattern:
- Flutter Layer: Provides a simple Dart API for your Flutter app
- Native Layer: Uses compiled binaries (.aar for Android, .framework for iOS)
- Flutter UI Screens: Includes Flutter screens for the verification flow while delegating core verification to the native SDKs
Integration References #
- Android SDK: Surepass native Android SDK reference implementation (available to authorized customers)
- iOS SDK: Surepass native iOS SDK reference implementation (available to authorized customers)
Features #
- ✅ Thin wrapper over native SDKs
- ✅ Android (.aar) and iOS (.framework) support
- ✅ Sandbox and Production environments
- ✅ Simple API with callbacks
- ✅ Customizable UI accent colors (native SDK feature)
- ✅ Lightweight package
Installation #
Add Dependency #
Add this to your package's pubspec.yaml file:
dependencies:
digilocker_flutter_sdk: ^1.0.1
Then run:
flutter pub get
Android Setup #
-
Minimum SDK: Ensure your
android/app/build.gradlehas:android { defaultConfig { minSdkVersion 28 // Required by Surepass DigiLocker SDK } } -
Internet Permission: The plugin automatically adds internet permissions. Ensure your
AndroidManifest.xmlincludes:<uses-permission android:name="android.permission.INTERNET" /> -
Native SDK (.aar): The
digilocker_sdk.aarfile should be placed inandroid/libs/directory of the plugin. The plugin automatically includes it viabuild.gradle. -
Kotlin: The plugin uses Kotlin. Ensure your project supports Kotlin (Flutter projects do by default).
iOS Setup #
-
Minimum iOS Version: iOS 13.0 or higher
-
CocoaPods: Run pod install in your iOS directory:
cd ios pod install cd .. -
Native SDK (.framework): The
DigilockerSdk.frameworkshould be placed in theios/directory of the plugin. The podspec automatically includes it.
Usage #
Basic Example #
import 'package:digilocker_flutter_sdk/digilocker_sdk.dart';
// Start verification
await DigilockerSdk.start(
context: context,
apiToken: 'your_api_token_here',
environment: Environment.sandbox, // or Environment.production
onComplete: (result) {
if (result.success) {
print('Verification successful!');
print('Data: ${result.data}');
} else {
print('Verification failed: ${result.message}');
}
},
onError: (error) {
print('Error occurred: $error');
},
);
Complete Example #
import 'package:flutter/material.dart';
import 'package:digilocker_flutter_sdk/digilocker_sdk.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
Future<void> _startVerification(BuildContext context) async {
// Optional: Set accent color
await DigilockerSdk.setAccentColor(Colors.blue);
// Start verification
await DigilockerSdk.start(
context: context,
apiToken: 'your_api_token_here',
environment: Environment.sandbox,
onComplete: (result) {
if (result.success) {
// Handle success
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Verification successful!')),
);
// Access verification data
if (result.data != null) {
print('Verification data: ${result.data}');
}
} else {
// Handle failure
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Verification failed: ${result.message ?? "Unknown error"}')),
);
}
},
onError: (error) {
// Handle error
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $error')),
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('DigiLocker SDK Demo')),
body: Center(
child: ElevatedButton(
onPressed: () => _startVerification(context),
child: Text('Start DigiLocker Verification'),
),
),
);
}
}
Get SDK Version #
String version = await DigilockerSdk.getVersion();
print('SDK Version: $version');
Set Accent Color #
await DigilockerSdk.setAccentColor(Colors.blue);
API Reference #
DigilockerSdk.start() #
Starts the DigiLocker verification flow.
Parameters:
context(required): BuildContext for navigationapiToken(required): Your Surepass API tokenenvironment(optional):Environment.sandboxorEnvironment.production(default:Environment.sandbox)onComplete(optional): Callback when verification completes withVerificationResultonError(optional): Callback for error handling with error message
VerificationResult:
success: Boolean indicating if verification was successfulmessage: Optional message stringdata: Optional Map containing verification data
DigilockerSdk.getVersion() #
Returns the SDK version as a String.
DigilockerSdk.setAccentColor() #
Sets the accent color for UI elements (if supported by native SDK).
Project Structure #
digilocker-flutter-sdk/
├── lib/
│ └── digilocker_sdk.dart # Flutter API
├── android/
│ ├── src/main/kotlin/
│ │ └── DigilockerPlugin.kt # Android plugin implementation
│ ├── libs/
│ │ └── digilocker_sdk.aar # Android native SDK
│ └── build.gradle # Android build configuration
├── ios/
│ ├── Classes/
│ │ └── DigilockerPlugin.swift # iOS plugin implementation
│ └── DigilockerSdk.framework/ # iOS native SDK
└── pubspec.yaml
Requirements #
- Flutter SDK: >=3.0.0
- Dart SDK: >=3.0.0 <4.0.0
- Android: minSdkVersion 28 (required by native SDK)
- iOS: 13.0+
Native SDK Integration #
For Plugin Maintainers #
If you're maintaining this plugin and need to update the native SDKs:
Android (.aar)
- Obtain the latest
digilocker_sdk.aarfrom Surepass - Place it in
android/libs/digilocker_sdk.aar - The
build.gradleautomatically includes all .aar files from the libs directory
iOS (.framework)
- Obtain the latest
DigilockerSdk.frameworkfrom Surepass - Place it in
ios/DigilockerSdk.framework/ - The podspec automatically includes the framework
Troubleshooting #
Android Issues #
- SDK not integrated error: Ensure
digilocker_sdk.aaris inandroid/libs/directory of the plugin - Build errors: Ensure Kotlin is properly configured and minSdkVersion is 26+
- Permission errors: Check that internet permission is in AndroidManifest.xml
- Gradle sync issues: Try
flutter cleanand rebuild
iOS Issues #
- SDK not integrated error: Ensure
DigilockerSdk.frameworkis inios/directory of the plugin - Framework not found: Run
pod installin the ios directory - Build errors: Ensure iOS deployment target is 13.0 or higher
- Signing issues: Configure code signing in Xcode
Common Issues #
- "SDK_NOT_INTEGRATED" error: This means the native SDK binary (.aar or .framework) is not present in the plugin. Contact Surepass to obtain the native SDK files.
- Network errors: Ensure device has internet connectivity and API token is valid
- Token expired: Generate a new API token from Surepass dashboard
Support #
For issues, questions, or feature requests:
- Email: techsupport@surepass.app
Publisher #
This package is published by surepass.io.
License #
This SDK is proprietary and distributed under a commercial license. See the LICENSE file.
Copyright (c) 2026 Surepass. All rights reserved.