trustchex_flutter_sdk 1.338.5 copy "trustchex_flutter_sdk: ^1.338.5" to clipboard
trustchex_flutter_sdk: ^1.338.5 copied to clipboard

Identity verification and face authentication SDK with document scanning, liveness detection, NFC/eID reading, and biometric technology for Flutter apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:trustchex_flutter_sdk/trustchex_flutter_sdk.dart';
import 'dart:developer' as dev;

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  dev.log('TRUSTCHEX: App starting...', name: 'trustchex');
  runApp(const TrustchexExampleApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Trustchex SDK Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.black),
        useMaterial3: true,
        scaffoldBackgroundColor: Colors.white,
      ),
      localizationsDelegates: AppLocalizations.localizationsDelegates,
      supportedLocales: AppLocalizations.supportedLocales,
      home: const ExampleHomeScreen(),
    );
  }
}

/// Home screen with session code input and QR code scanning
class ExampleHomeScreen extends StatefulWidget {
  const ExampleHomeScreen({super.key});

  @override
  State<ExampleHomeScreen> createState() => _ExampleHomeScreenState();
}

class _ExampleHomeScreenState extends State<ExampleHomeScreen> {
  @override
  Widget build(BuildContext context) {
    return TrustchexView(
      baseUrl: 'https://app.trustchex.com',
      branding: const TrustchexBranding(
        primaryColor: Colors.black,
        secondaryColor: Color(0xFFCCCCCC),
        tertiaryColor: Colors.red,
      ),
      locale: TrustchexLocale.en,
      enableAnalytics: true,
      onCompleted: () {
        debugPrint('Verification completed!');
      },
      onError: (error) {
        debugPrint('Verification error: $error');
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(
            content: Text('Error: $error'),
            backgroundColor: Colors.red,
          ),
        );
      },
    );
  }
}