kyc_workflow 0.0.7
kyc_workflow: ^0.0.7 copied to clipboard
Digio kyc workflow plugin
example/lib/main.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:kyc_workflow/digio_config.dart';
import 'package:kyc_workflow/environment.dart';
import 'package:kyc_workflow/kyc_workflow.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 _workflowResult = '';
@override
void initState() {
super.initState();
startKycWorkflow();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> startKycWorkflow() async {
var workflowResult;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
var digioConfig = DigioConfig();
digioConfig.theme.primaryColor = "#32a83a";
digioConfig.logo =
"https://www.gstatic.com/mobilesdk/160503_mobilesdk/logo/2x/firebase_28dp.png";
digioConfig.environment = Environment.SANDBOX;
final _kycWorkflowPlugin = KycWorkflow(digioConfig);
workflowResult = await _kycWorkflowPlugin.start(
"KID2303141736498859A78N9KGQM2NS8",
"[email protected]",
"GWT230314173649919G9KYXPSX1BF7PP",
null);
print('workflowResult : ' + workflowResult.toString());
} on PlatformException {
workflowResult = 'Failed to get platform version.';
}
// 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(() {
_workflowResult = workflowResult.toString();
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Result : $_workflowResult'),
),
),
);
}
}