risk_dfp_flutter 1.0.2
risk_dfp_flutter: ^1.0.2 copied to clipboard
Facilitates secure device info collection and analysis for seamless integration of Risk Detection and Fraud Prevention in Flutter apps, enhancing security.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:risk_dfp_flutter/risk_dfp_flutter.dart';
import 'ui/home.dart';
// void main() async {
// await _initHive();
// runApp(const MainApp());
// }
//
void main() async {
await _initHive();
runApp(const MyApp());
}
Future<void> _initHive() async {
await Hive.initFlutter();
await Hive.openBox("login");
await Hive.openBox("accounts");
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FutureBuilder<String>(
future: RiskDfpFlutter.getDeviceFingerPrint,
builder: (_, snapshot) {
final currentContext = context; // Store the context
return ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
onPressed: () async {
await RiskDfpFlutter.submitDeviceFingerPrint({
"userId": "",
"key":
'-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvrREu/3vhvooI0eagazr\nA4575l2PJNktpCHzK+6Vpvtt+QKZ3GUc4xAdRk9QfwRNpsTEjdP/YBWmVv3FhHHs\nKtOMMsTYF1jJoxLUtVnloKP5MvkjTgZwuKz66l4y/cgObNs4opeGRKLDEOITOx+f\nBG9oRv7h86yYC3BeeEyuhy4RKoo7Nu8nxayN3J8L9G4SRjaWOkULKWIGNYXSw1iH\nXvFR7HCmt1AD/9JrHrl6LjnAE2qNu8CMkmQKpctFrv49bkvxixZtsHyCgnPyUl9Q\nAN/zhJPm1d1U26z1MEYx38nf2sgKIvRqvkjuZpupSFyOUnGc1cn8EnBvpCYZsEPr\nswIDAQAB\n-----END PUBLIC KEY-----',
"endpoint":
"https://rdx.zalopay.vn/v1/api/gimo/android/dfp",
});
},
child: const Text("Click Me"),
);
},
),
],
),
),
),
);
}
}