✨Works out of the box guarantee. If you face any issue at all, hit us up on Telegram and we will write the integration for you.
logoReclaim Protocol Docs
Flutter SDK

Usage

Flutter SDK for Reclaim Protocol

  1. Import the SDK in your Dart file:
import 'package:reclaim_inapp_flutter_sdk/reclaim_inapp_flutter_sdk.dart';
  1. Initialize the SDK with your app credentials:

Following is an exmaple.

const String appId = String.fromEnvironment('APP_ID');
const String appSecret = String.fromEnvironment('APP_SECRET');
const String providerId = String.fromEnvironment('PROVIDER_ID');

Starting Verification

final sdk = ReclaimInAppSdk.of(context);
final proofs = await sdk.startVerification(
  ReclaimVerificationRequest(
    appId: appId,
    providerId: providerId,
    secret: appSecret,
    sessionInformation: ReclaimSessionInformation.empty(),
    contextString: '',
    parameters: {},
    claimCreationType: ClaimCreationType.standalone,
  ),
);

Configuration Options

The ReclaimVerificationRequest supports the following options:

  • appId: Your Reclaim application ID
  • providerId: The ID of the provider you want to verify against
  • secret: Your application secret (optional if using session information)
  • sessionInformation: Session information for authentication
  • contextString: Additional context for the verification
  • parameters: Custom parameters for the verification
  • claimCreationType: Type of claim creation (standalone or meChain)
  • autoSubmit: Whether to auto-submit the verification
  • hideCloseButton: Whether to hide the close button
  • webhookUrl: URL for webhook notifications
  • verificationOptions: Additional verification options

Error Handling

The SDK throws specific exceptions that you can handle:

try {
  final proofs = await sdk.startVerification(request);
} on ReclaimExpiredSessionException {
  // Handle expired session
} on ReclaimVerificationManualReviewException {
  // Handle manual review case
} catch (error) {
  // Handle other errors if required
}

Pre-warming

For better performance, you can pre-warm the SDK:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  ReclaimInAppSdk.preWarm();
  runApp(MyApp());
}

Environment Variables

The SDK requires the following environment variables:

  • APP_ID: Your Reclaim application ID
  • APP_SECRET: Your application secret
  • PROVIDER_ID: The ID of the provider to verify against

You can provide these values using:

  • Dart Define Env file: --dart-define-from-file=./.env
  • Hardcoded values (not recommended for production)

Example

Check out the example for a complete implementation.

On this page