idmeta_flutter 0.2.0
idmeta_flutter: ^0.2.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';
// Path A (core only). For IAD, see README → Path B (private idmeta_iad package).
//
// ID Screen / kiosk testing (avoids keyboard paste truncation):
// flutter run --dart-define=IDMETA_USER_TOKEN=... \
// --dart-define=IDMETA_CLIENT_ID=... \
// --dart-define=IDMETA_TRUST_FLOW_ID=123
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(home: 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(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
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),
const Icon(
Icons.verified_user,
size: 80,
color: Colors.blueAccent,
),
const SizedBox(height: 24),
const Text(
'IDmeta Identity Verification',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
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: () {
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;
}
IdmetaFlutter.startVerification(
context: context,
userToken: userToken,
clientId: clientId,
trustFlowId: trustFlowId,
metadata: const {
'accID': 99381,
'branch_location': 'KL',
'is_premium_tier': true,
},
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blueAccent,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 2,
),
child: const Padding(
padding: EdgeInsets.symmetric(vertical: 14),
child: Text(
'Start Verification',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),
),
),
],
),
),
),
);
}
}