flutter_shieldfraud 1.0.4 flutter_shieldfraud: ^1.0.4 copied to clipboard
Flutter plugin for Shield SDK. SHIELD SDK helps developers to assess malicious activities performed on mobile devices and return risk intelligence based on user's behaviour.
import 'dart:collection';
import 'package:flutter/material.dart';
import 'package:flutter_shieldfraud/plugin_shieldfraud.dart';
import 'package:flutter_shieldfraud/shield_config.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
ShieldCallback shieldCallback =
ShieldCallback((Map<String, dynamic> result) {
print("callback result: $result");
}, (ShieldError error) {
print("callback error: ${error.message}");
});
ShieldConfig config = ShieldConfig(
siteID: "dda05c5ddac400e1c133a360e2714aada4cda052",
key: "9ce44f88a25272b6d9cbb430ebbcfcf1",
shieldCallback: shieldCallback,
enableShieldProcess: true,
logLevel: ShieldLogLevel.debug);
Shield.isShieldInitialized
.then((value) => print("Shield is initialized: $value"));
Shield.sessionId.then((value) => print("session id $value"));
Shield.initShield(config);
Shield.isShieldInitialized.then((value) => {
print("Shield is initialized second call: $value"),
if (value)
{
Shield.sessionId
.then((value) => print("actual sessionID: $value"))
}
});
Map<String, String> data = HashMap();
data["user_id"] = "123";
data["email"] = "test@gmail.com";
Shield.sendAttributes("test", data)
.then((value) => print("successfully sent attributes: $value"));
Shield.latestDeviceResult.then((latestDeviceResult) => {
if (latestDeviceResult == null)
{print("error ${Shield.latestError?.message}")}
else
{print("result $latestDeviceResult")}
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: MaterialButton(
onPressed: () {
Shield.sendDeviceSignature("test sending device signature").then(
(value) => print(
"sending device signature in real time successful: $value"));
},
child: const Text("Send attributes"),
)),
),
);
}
}