eldik_myid 1.0.2
eldik_myid: ^1.0.2 copied to clipboard
Eldik SDK plugin for Flutter. Package supports iOS and Android to verify users identity.
example/lib/main.dart
import 'dart:async';
import 'package:eldik_myid/eldik_myid.dart';
import 'package:eldik_myid/eldik_myid_config.dart';
import 'package:eldik_myid/eldik_myid_enums.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String? _error;
EldikResult? _result;
Future<void> init() async {
String? error;
EldikResult? result;
try {
final eldikResult = await EldikClient.start(
config: EldikConfig(
entryMode: EldikEntryMode.selfieOnly,
locale: EldikLocale.kyrgyz,
withSoundGuides: true
),
iosAppearance: const EldikIOSAppearance()
);
error = null;
result = eldikResult;
} catch (e) {
error = e.toString();
result = null;
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_error = error;
_result = result;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Eldik Sample'),
),
body: Center(
child: Column(
children: [
MaterialButton(
onPressed: init,
child: const Text('Start SDK'),
),
Text(_result?.tinFront ?? _error ?? 'Failure'),
],
),
),
),
);
}
}