blusalt_document_verification 0.1.0 copy "blusalt_document_verification: ^0.1.0" to clipboard
blusalt_document_verification: ^0.1.0 copied to clipboard

Document Verification SDK for Android and IOS

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:blusalt_document_verification/blusalt_document_verification.dart';

String clientId = "";
String appName = "";
String apiKey = "";
bool isDev = false;

void main() {
  BlusaltDocumentVerification()
      .initializeSDK(clientID: clientId, appName: appName, apiKey: apiKey);
  runApp(const MaterialApp(
      title: 'Blusalt Identity Flutter SDK Demo',
      themeMode: ThemeMode.light,
      home: MyApp()));
}

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

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

class _MyAppState extends State<MyApp> {
  BlusaltIdentityResultResponse? response;

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

  Future<BlusaltIdentityResultResponse?> startSDK() async {
    response = await BlusaltDocumentVerification()
        .startSDK(BlusaltIdentityType.selector);

    return response;
  }

  Future<BlusaltIdentityResultResponse?> startSDKWithCustomSelector() async {
    response = await BlusaltDocumentVerification().startSDKWithCustomSelector(
        [BlusaltIdentityType.bvn, BlusaltIdentityType.nin]);

    return response;
  }

  Future<BlusaltIdentityResultResponse?> startSDKWithIdNumber() async {
    response = await BlusaltDocumentVerification()
        .startSDKWithIdNumber(BlusaltIdentityType.nin, "12122333321");

    return response;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Padding(
          padding: EdgeInsets.symmetric(
              horizontal: context.width * 0.1, vertical: context.height * 0.1),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              if (response != null)
                Center(
                  child: Text(
                      'Result: ${response?.blusaltIdentityResult?.personalInfo?.firstName ?? ''}'),
                ),
              SizedBox(
                height: context.height * 0.1,
              ),
              MaterialButton(
                  color: Colors.blueAccent,
                  textColor: Colors.white,
                  onPressed: () {
                    startSDK();
                  },
                  child: const Text('Start identity')),
              MaterialButton(
                  color: Colors.blueAccent,
                  textColor: Colors.white,
                  onPressed: () {
                    startSDKWithCustomSelector();
                  },
                  child: const Text('Start identity with custom selector')),
              MaterialButton(
                  color: Colors.blueAccent,
                  textColor: Colors.white,
                  onPressed: () {
                    startSDKWithIdNumber();
                  },
                  child: const Text('Start identity with number'))
            ],
          ),
        ),
      ),
    );
  }
}

extension CustomBuildContext on BuildContext {
  double get height => MediaQuery.of(this).size.height;

  double get width => MediaQuery.of(this).size.width;
}
1
likes
130
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

Document Verification SDK for Android and IOS

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on blusalt_document_verification