Flutter

Integrating verisync SDK into your flutter application

Install

flutter pub add verisync

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  verisync: ^0.0.7

Usage

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:verisync/verisync.dart';

Future main() async {
  WidgetsFlutterBinding.ensureInitialized();
  var status = await Permission.camera.status;
  if (status.isDenied) {
    await Permission.camera.request();
  } else if (status.isPermanentlyDenied) {
    openAppSettings();
  }
  runApp(const MaterialApp(home: MyApp()));
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Verisync Example'),
        ),
        body: SizedBox(
          width: MediaQuery.of(context).size.width,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton(
                onPressed: () {
                  showAdaptiveDialog(
                    context: context,
                    builder: (BuildContext dialogContext) => VerisyncWidget(
                      flowId: "<provide your call flowID>",
                      redirectUrl: "<provide your redirectUrl>",
                      clientId: "provide your clientID",
                      email: "provide email",
                      metadata: const {
                        "name": "John Doe",
                        "phone": "1234567890",
                      },
                      callbackSuccess: (dialogContext) {
                        ScaffoldMessenger.of(dialogContext).showSnackBar(
                          const SnackBar(
                            content: Text("Verification successful"),
                            duration: Duration(seconds: 3),
                          ),
                        );
                      },
                    ),
                  );
                },
                child: const Text('Verify your identity'),
              ),
            ],
          ),
        ));
  }
}
Parameter name
Type
Required
Description

flowId

string

true

The id of the flow created of the request user info

clientId

string

true

The client ID you received from Verisync it's on your dashboard integration page

redirectUrl

string

true

The URL where your users will be sent after authorization.

email

string

false

The user email address

metadata

object

false

Stringified JSON object of custom data.

Last updated