gts_myid 1.0.8
gts_myid: ^1.0.8 copied to clipboard
GTS-MyID SDK plugin for Flutter. Package supports iOS and Android to verify users identity.
example/lib/main.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:gts_myid/enums.dart';
import 'package:gts_myid/gts_myid.dart';
import 'package:gts_myid/gts_myid_config.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;
GtsResult? _result;
Future<void> init() async {
String? error;
GtsResult? result;
try {
final gtsResult = await GtsClient.start(config: GtsConfig(
locale: GtsLocale.kyrgyz
));
error = null;
result = gtsResult;
} 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('Gts-MyID Sample'),
),
body: Center(
child: Column(
children: [
MaterialButton(
onPressed: init,
child: const Text('Start SDK'),
),
Text(_result?.imageBase64?.substring(0, 100) ?? _error ?? 'Failure'),
],
),
),
),
);
}
}