digilocker_flutter_sdk 1.0.2 copy "digilocker_flutter_sdk: ^1.0.2" to clipboard
digilocker_flutter_sdk: ^1.0.2 copied to clipboard

unlisted

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)
  • No Flutter UI: All UI and verification logic is handled by the native SDKs

Integration References #

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)
  • ✅ No Flutter UI dependencies - lightweight package

Installation #

Add Dependency #

Add this to your package's pubspec.yaml file:

dependencies:
  digilocker_flutter_sdk:
    git:
      url: https://github.com/surepassio/digilocker-flutter-sdk.git
      ref: v1.0.0

Or use the latest version:

dependencies:
  digilocker_flutter_sdk:
    git:
      url: https://github.com/surepassio/digilocker-flutter-sdk.git
      ref: master

Then run:

flutter pub get

Android Setup #

  1. Minimum SDK: Ensure your android/app/build.gradle has:

    android {
        defaultConfig {
            minSdkVersion 28  // Required by Digiboost SDK
        }
    }
    
  2. Internet Permission: The plugin automatically adds internet permissions. Ensure your AndroidManifest.xml includes:

    <uses-permission android:name="android.permission.INTERNET" />
    
  3. Native SDK (.aar): The digilocker_sdk.aar file should be placed in android/libs/ directory of the plugin. The plugin automatically includes it via build.gradle.

  4. Kotlin: The plugin uses Kotlin. Ensure your project supports Kotlin (Flutter projects do by default).

iOS Setup #

  1. Minimum iOS Version: iOS 13.0 or higher

  2. CocoaPods: Run pod install in your iOS directory:

    cd ios
    pod install
    cd ..
    
  3. Native SDK (.framework): The DigilockerSdk.framework should be placed in the ios/ 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 navigation
  • apiToken (required): Your Surepass API token
  • environment (optional): Environment.sandbox or Environment.production (default: Environment.sandbox)
  • onComplete (optional): Callback when verification completes with VerificationResult
  • onError (optional): Callback for error handling with error message

VerificationResult:

  • success: Boolean indicating if verification was successful
  • message: Optional message string
  • data: 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 26 (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)

  1. Obtain the latest digilocker_sdk.aar from Surepass
  2. Place it in android/libs/digilocker_sdk.aar
  3. The build.gradle automatically includes all .aar files from the libs directory

iOS (.framework)

  1. Obtain the latest DigilockerSdk.framework from Surepass
  2. Place it in ios/DigilockerSdk.framework/
  3. The podspec automatically includes the framework

Troubleshooting #

Android Issues #

  1. SDK not integrated error: Ensure digilocker_sdk.aar is in android/libs/ directory of the plugin
  2. Build errors: Ensure Kotlin is properly configured and minSdkVersion is 26+
  3. Permission errors: Check that internet permission is in AndroidManifest.xml
  4. Gradle sync issues: Try flutter clean and rebuild

iOS Issues #

  1. SDK not integrated error: Ensure DigilockerSdk.framework is in ios/ directory of the plugin
  2. Framework not found: Run pod install in the ios directory
  3. Build errors: Ensure iOS deployment target is 13.0 or higher
  4. Signing issues: Configure code signing in Xcode

Common Issues #

  1. "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.
  2. Network errors: Ensure device has internet connectivity and API token is valid
  3. Token expired: Generate a new API token from Surepass dashboard

Support #

For issues, questions, or feature requests:

License #

Copyright (c) 2024 Surepass. All rights reserved.

0
likes
0
points
196
downloads

Publisher

verified publishersurepass.io

Weekly Downloads

A Flutter plugin wrapper for Surepass DigiLocker SDK with compiled binaries (AAR/Framework)

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, provider, webview_flutter

More

Packages that depend on digilocker_flutter_sdk

Packages that implement digilocker_flutter_sdk