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

A Flutter SDK for KYC verification

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Autheo SDK Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        useMaterial3: true,
      ),
      home: const HomePage(),
    );
  }
}

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

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final firstNameController = TextEditingController();
  final lastNameController = TextEditingController();
  final phoneController = TextEditingController();
  final emailController = TextEditingController();

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Autheo SDK Example'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            TextField(
              controller: firstNameController,
              decoration: const InputDecoration(
                labelText: 'First name',
                border: OutlineInputBorder(),
              ),
            ),
            const SizedBox(height: 16),
            TextField(
              controller: lastNameController,
              decoration: const InputDecoration(
                labelText: 'Last name',
                border: OutlineInputBorder(),
              ),
            ),
            const SizedBox(height: 16),
            TextField(
              controller: phoneController,
              decoration: const InputDecoration(
                labelText: 'Phone number',
                border: OutlineInputBorder(),
              ),
            ),
            const SizedBox(height: 16),
            TextField(
              controller: emailController,
              decoration: const InputDecoration(
                labelText: 'Email',
                border: OutlineInputBorder(),
              ),
            ),
            const SizedBox(height: 24),
            ElevatedButton(
              onPressed: () async {
                try {

                  final result = await AutheoSDK.startVerification(context,
                      apiKey: 'autheo-api-key',
                      email: emailController.text,
                      phone: phoneController.text,
                      firstName: firstNameController.text,
                      lastName: lastNameController.text,
                      businessId: 'autheo-business-id',
                      verificationType: 'KYC Verification',
                      isAddressCheck: false,
                      isAmlCheck: false,
                      isCreditCheck: false
                  );

                  if (result.isSuccess) {
                    debugPrint('Verification passed ${result.data}');
                  } else {
                    debugPrint('Verification failed: ${result.message}');
                  }
                } catch (e) {
                  ScaffoldMessenger.of(context).showSnackBar(
                    SnackBar(content: Text('Error: $e')),
                  );
                }
              },
              child: const Text('Launch Verification'),
            ),
          ],
        ),
      ),
    );
  }
}