Skip to main content

Documentation Index

Fetch the complete documentation index at: https://jdev-e8db0569.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

This guide shows you how to initialize the SEON SDK and run a complete verification flow.

Complete Example

import 'package:flutter/material.dart';
import 'package:seon_orchestration_flutter/seon_orchestration_flutter.dart';

class SeonVerificationScreen extends StatefulWidget {
  const SeonVerificationScreen({super.key});

  @override
  State<SeonVerificationScreen> createState() => _SeonVerificationScreenState();
}

class _SeonVerificationScreenState extends State<SeonVerificationScreen> {
  bool _isInitialized = false;
  bool _isVerifying = false;

  @override
  void initState() {
    super.initState();
    _initializeSeon();
  }

  Future<void> _initializeSeon() async {
    try {
      await SeonOrchestration.initialize(const SeonConfig(
        baseUrl: 'https://your-seon-api-url.com',
        token: 'your-session-token',
        language: 'en',
      ));
      setState(() => _isInitialized = true);
      debugPrint('SEON SDK initialized successfully');
    } on SeonException catch (e) {
      debugPrint('Failed to initialize SEON SDK: $e');
    }
  }

  Future<void> _handleVerification() async {
    if (!_isInitialized) return;

    setState(() => _isVerifying = true);
    try {
      final result = await SeonOrchestration.startVerification();

      switch (result.status) {
        case SeonVerificationStatus.completed:
        case SeonVerificationStatus.completedSuccess:
          _showDialog('Success', 'Verification completed successfully');
          break;
        case SeonVerificationStatus.completedPending:
          _showDialog('Pending', 'Verification is pending review');
          break;
        case SeonVerificationStatus.completedFailed:
          _showDialog('Failed', 'Verification failed');
          break;
        case SeonVerificationStatus.interruptedByUser:
          _showDialog('Cancelled', 'Verification was cancelled');
          break;
        case SeonVerificationStatus.missingLocationPermission:
          _showDialog('Permission Required', 'Location permission is required');
          break;
        case SeonVerificationStatus.error:
          _showDialog('Error', result.errorMessage ?? 'An error occurred');
          break;
      }
    } on SeonException catch (e) {
      _showDialog('Error', 'Failed to complete verification: ${e.message}');
    } finally {
      setState(() => _isVerifying = false);
    }
  }

  void _showDialog(String title, String message) {
    showDialog(
      context: context,
      builder: (ctx) => AlertDialog(
        title: Text(title),
        content: Text(message),
        actions: [TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('OK'))],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('SEON Verification')),
      body: Center(
        child: ElevatedButton(
          onPressed: (!_isInitialized || _isVerifying) ? null : _handleVerification,
          child: Text(_isVerifying ? 'Verifying...' : 'Start Verification'),
        ),
      ),
    );
  }
}

Step-by-Step Breakdown

1. Initialize the SDK

Call SeonOrchestration.initialize() before starting verification. The SDK remains initialized until dispose() is called, so you only need to initialize once:
await SeonOrchestration.initialize(const SeonConfig(
  baseUrl: 'https://your-seon-api-url.com',
  token: 'your-session-token',
  language: 'en',    // optional
));
The baseUrl and token are provided by your backend. The language and theme parameters are optional — the SDK defaults to the device language and light theme.

2. Start a verification

Once initialized, call startVerification() to present the verification UI:
final result = await SeonOrchestration.startVerification();

3. Handle the result

The result contains a status field indicating the outcome:
StatusMeaning
completedVerification completed (generic)
completedSuccessVerification passed
completedPendingVerification completed, pending manual review
completedFailedVerification failed
interruptedByUserUser cancelled the flow
errorAn error occurred (check errorMessage)
missingLocationPermissionLocation permission was denied (Android)

4. Clean up (optional)

When verification is no longer needed (e.g., on logout or navigation away), release SDK resources:
await SeonOrchestration.dispose();
Always call initialize() before startVerification(). Calling startVerification() without initializing will throw a SeonException with code SeonErrorCode.eNotInitialized.

Next Steps

API Reference

Explore the full API documentation

Platform Notes

iOS and Android specific details