flutter_shieldfraud 0.0.2 copy "flutter_shieldfraud: ^0.0.2" to clipboard
flutter_shieldfraud: ^0.0.2 copied to clipboard

PlatformAndroidiOS
outdated

Flutter plugin for Shield SDK

example/lib/main.dart

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);
    Shield.initShield(config);

    Shield.sessionId
        .then((sessionId) => print("shield sessionId: $sessionId"));

    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: () {
            var attributes = {"user_id":"123", "email": "testing"};
            Shield.sendAttributes("main", attributes)
            .then((value) => print("successfully sent: $value"));
          }, child: const Text("Send attributes"),)
        ),
      ),
    );
  }
}
4
likes
110
pub points
65%
popularity

Publisher

unverified uploader

Flutter plugin for Shield SDK

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_shieldfraud