risk_dfp_flutter 1.0.4 copy "risk_dfp_flutter: ^1.0.4" to clipboard
risk_dfp_flutter: ^1.0.4 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/foundation.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": "",// add your user id here
                        "key": "", // add your public key here
                        "endpoint": // add your endpoint here
                        "https://helios-ext.gimo.xyz/v1/api/gimo/${_getApp()}/dfp",// example endpoint
                      });
                    },
                    child: const Text("Click Me"),
                  );
                },
              ),
            ],
          ),
        ),
      ),
    );
  }

  String _getApp() => kIsWeb
      ? 'Web Browser info'
      : switch (defaultTargetPlatform) {
    TargetPlatform.android => 'android',
    TargetPlatform.iOS => 'ios',
    TargetPlatform.linux => '',
    TargetPlatform.windows => '',
    TargetPlatform.macOS => '',
    TargetPlatform.fuchsia => '',
  };
}
0
likes
120
points
5
downloads

Publisher

unverified uploader

Weekly Downloads

Facilitates secure device info collection and analysis for seamless integration of Risk Detection and Fraud Prevention in Flutter apps, enhancing security.

Homepage

Documentation

API reference

License

BSL-1.0 (license)

Dependencies

basic_utils, encrypt, flutter, flutter_dotenv, http, plugin_platform_interface

More

Packages that depend on risk_dfp_flutter

Packages that implement risk_dfp_flutter