Skip to main content

idmeta_flutter 2.3.0 copy "idmeta_flutter: ^2.3.0" to clipboard
idmeta_flutter: ^2.3.0 copied to clipboard

Flutter plugin for IDmeta identity verification on Android and iOS. Integrate trust flows for document, biometric, and compliance checks in mobile apps using your IDmeta account.

example/lib/main.dart

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

// Optional: prefill the form at launch instead of typing or pasting a long
// token:
// flutter run --dart-define=IDMETA_USER_TOKEN=... \
//   --dart-define=IDMETA_CLIENT_ID=... \
//   --dart-define=IDMETA_TRUST_FLOW_ID=123

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

const _navy = Color(0xFF000040);

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
          seedColor: _navy,
        ).copyWith(primary: _navy, onPrimary: Colors.white),
        appBarTheme: const AppBarTheme(
          backgroundColor: _navy,
          foregroundColor: Colors.white,
          centerTitle: true,
        ),
        elevatedButtonTheme: ElevatedButtonThemeData(
          style: ElevatedButton.styleFrom(
            backgroundColor: _navy,
            foregroundColor: Colors.white,
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(8),
            ),
            elevation: 2,
          ),
        ),
      ),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController _tokenController = TextEditingController();
  final TextEditingController _flowIdController = TextEditingController();
  final TextEditingController _clientIdController = TextEditingController();

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

    const token = String.fromEnvironment('IDMETA_USER_TOKEN');
    const clientId = String.fromEnvironment('IDMETA_CLIENT_ID');
    const flowId = String.fromEnvironment('IDMETA_TRUST_FLOW_ID');

    if (token.isNotEmpty) {
      _tokenController.text = token;
    }
    if (clientId.isNotEmpty) {
      _clientIdController.text = clientId;
    }
    if (flowId.isNotEmpty) {
      _flowIdController.text = flowId;
    }
  }

  @override
  void dispose() {
    _tokenController.dispose();
    _flowIdController.dispose();
    _clientIdController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('IDmeta Flutter SDK')),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(24.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              const SizedBox(height: 40),
              // The IDmeta logo the SDK ships as a package asset.
              Image.asset(
                'assets/idmeta_logo_main.png',
                package: 'idmeta_flutter',
                height: 80,
              ),
              const SizedBox(height: 24),
              const Text(
                'IDmeta Identity Verification',
                textAlign: TextAlign.center,
                style: TextStyle(
                  fontSize: 24,
                  fontWeight: FontWeight.bold,
                  color: _navy,
                ),
              ),
              const SizedBox(height: 40),
              const Text(
                'User Token',
                style: TextStyle(
                  fontSize: 14,
                  fontWeight: FontWeight.w600,
                  color: Colors.black87,
                ),
              ),
              const SizedBox(height: 8),
              TextField(
                controller: _tokenController,
                decoration: InputDecoration(
                  hintText: 'Enter user token',
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(8),
                  ),
                  prefixIcon: const Icon(Icons.key),
                ),
              ),
              const SizedBox(height: 24),
              const Text(
                'Trust Flow ID',
                style: TextStyle(
                  fontSize: 14,
                  fontWeight: FontWeight.w600,
                  color: Colors.black87,
                ),
              ),
              const SizedBox(height: 8),
              TextField(
                controller: _flowIdController,
                decoration: InputDecoration(
                  hintText: 'Enter trust flow ID',
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(8),
                  ),
                  prefixIcon: const Icon(Icons.numbers),
                ),
                keyboardType: TextInputType.number,
              ),
              const SizedBox(height: 24),
              const Text(
                'Client ID',
                style: TextStyle(
                  fontSize: 14,
                  fontWeight: FontWeight.w600,
                  color: Colors.black87,
                ),
              ),
              const SizedBox(height: 8),
              TextField(
                controller: _clientIdController,
                decoration: InputDecoration(
                  hintText: 'Enter client ID',
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(8),
                  ),
                  prefixIcon: const Icon(Icons.badge_outlined),
                ),
              ),
              const SizedBox(height: 40),
              ElevatedButton(
                onPressed: () async {
                  final userToken = _tokenController.text.trim();
                  final clientId = _clientIdController.text.trim();
                  final trustFlowId = int.tryParse(
                    _flowIdController.text.trim(),
                  );
                  if (userToken.isEmpty ||
                      trustFlowId == null ||
                      clientId.isEmpty) {
                    ScaffoldMessenger.of(context).showSnackBar(
                      const SnackBar(
                        content: Text(
                          'Please enter user token, trust flow ID, and client ID',
                        ),
                      ),
                    );
                    return;
                  }
                  final result = await IdmetaFlutter.startVerification(
                    context: context,
                    userToken: userToken,
                    clientId: clientId,
                    trustFlowId: trustFlowId,
                    metadata: const {
                      'accID': 99381,
                      'branch_location': 'KL',
                      'is_premium_tier': true,
                    },
                  );
                  if (!context.mounted) return;
                  final message = switch (result.status) {
                    IdmetaVerificationStatus.completed =>
                      'Verification ${result.verificationId} submitted',
                    IdmetaVerificationStatus.cancelled =>
                      'Verification cancelled',
                    IdmetaVerificationStatus.failed =>
                      'Verification failed: ${result.errorMessage}',
                  };
                  ScaffoldMessenger.of(context)
                      .showSnackBar(SnackBar(content: Text(message)));
                },
                child: const Padding(
                  padding: EdgeInsets.symmetric(vertical: 14),
                  child: Text(
                    'Start Verification',
                    style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
150
points
1.34k
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for IDmeta identity verification on Android and iOS. Integrate trust flows for document, biometric, and compliance checks in mobile apps using your IDmeta account.

Homepage

License

MIT (license)

Dependencies

blinkid_flutter, camera, device_info_plus, file_picker, flutter, flutter_document_reader_api, flutter_document_reader_core_barcodemrz, flutter_secure_storage, geolocator, http, http_parser, image_picker, intl, intl_phone_field, mobile_scanner, path_provider, permission_handler, provider, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on idmeta_flutter

Packages that implement idmeta_flutter