verisoul_sdk 0.4.2 copy "verisoul_sdk: ^0.4.2" to clipboard
verisoul_sdk: ^0.4.2 copied to clipboard

Verisoul helps businesses stop fake accounts and fraud

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:verisoul_sdk/verisoul_sdk.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  VerisoulSdk.configure(
      projectId: "Project ID", environment: VerisoulEnvironment.prod);
  runApp(VerisoulWrapper(child: const MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String sessionId = "";

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Image.asset(
                    "assets/verisoul-logo-light.png",
                    height: 80,
                    fit: BoxFit.fill,
                  ),
                ),
                SizedBox(
                  height: 20,
                ),
                Text(
                  "Flutter Sample App",
                  textAlign: TextAlign.center,
                  style: TextStyle(
                      color: Color(0xFF000000),
                      fontSize: 20,
                      fontWeight: FontWeight.bold),
                ),
                SizedBox(
                  height: 20,
                ),
                Text(
                  "SessionID: $sessionId",
                  textAlign: TextAlign.center,
                  style: TextStyle(color: Color(0xFF000000), fontSize: 16),
                ),
                SizedBox(
                  height: 20,
                ),
                TextButton(
                    onPressed: () async {
                      try {
                        final session = await VerisoulSdk.getSessionApi();
                        setState(() {
                          sessionId = session ?? "Invalid";
                        });
                      } catch (e) {
                        setState(() {
                          sessionId = e.toString();
                        });
                      }
                    },
                    child: Text("Get Session ID")),
                if (kIsWeb)
                  TextButton(
                      onPressed: () async {
                        await VerisoulSdk.reinitialize();
                      },
                      child: Text("reinitialize")),
                if (kIsWeb)
                  TextButton(
                      onPressed: () async {
                        await VerisoulSdk.setAccountData(
                            id: "example-id",
                            email: "example@example.com",
                            metadata: {"paid": true});
                      },
                      child: Text("Set Account")),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
copied to clipboard
0
likes
160
points
485
downloads

Publisher

verified publisherverisoul.ai

Weekly Downloads

2024.09.26 - 2025.04.10

Verisoul helps businesses stop fake accounts and fraud

Homepage
Repository (GitHub)

Topics

#fake #verisoul #ai

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on verisoul_sdk