> ## Documentation Index
> Fetch the complete documentation index at: https://jdev-e8db0569.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Build your first SEON verification flow in Flutter.

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

## Complete Example

```dart theme={null}
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:

```dart theme={null}
await SeonOrchestration.initialize(const SeonConfig(
  baseUrl: 'https://your-seon-api-url.com',
  token: 'your-session-token',
  language: 'en',    // optional
));
```

<Info>
  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.
</Info>

### 2. Start a verification

Once initialized, call `startVerification()` to present the verification UI:

```dart theme={null}
final result = await SeonOrchestration.startVerification();
```

### 3. Handle the result

The result contains a `status` field indicating the outcome:

| Status                      | Meaning                                       |
| --------------------------- | --------------------------------------------- |
| `completed`                 | Verification completed (generic)              |
| `completedSuccess`          | Verification passed                           |
| `completedPending`          | Verification completed, pending manual review |
| `completedFailed`           | Verification failed                           |
| `interruptedByUser`         | User cancelled the flow                       |
| `error`                     | An error occurred (check `errorMessage`)      |
| `missingLocationPermission` | Location permission was denied (Android)      |

### 4. Clean up (optional)

When verification is no longer needed (e.g., on logout or navigation away), release SDK resources:

```dart theme={null}
await SeonOrchestration.dispose();
```

<Warning>
  Always call `initialize()` before `startVerification()`. Calling `startVerification()` without initializing will throw a `SeonException` with code `SeonErrorCode.eNotInitialized`.
</Warning>

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/api-reference/initialize">
    Explore the full API documentation
  </Card>

  <Card title="Platform Notes" icon="mobile" href="/guides/platform-notes">
    iOS and Android specific details
  </Card>
</CardGroup>
