blusalt_liveness_native 0.1.1 copy "blusalt_liveness_native: ^0.1.1" to clipboard
blusalt_liveness_native: ^0.1.1 copied to clipboard

Liveness SDK for Android and IOS

example/lib/main.dart

import 'package:blusalt_liveness_native/enums.dart';
import 'package:blusalt_liveness_native/liveness.dart';
import 'package:blusalt_liveness_native/model.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';

void main() {
  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  final _livenessPlugin = BlusaltLivenessNative();

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

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

  Future<BlusaltLivenessResultResponse?> startSDK() async {
    BlusaltLivenessResultResponse? response =
        await _livenessPlugin.startLivenessDetectionOnlySDK(
            apiKey: apiKey, appName: appName, clientId: clientId, isDev: isDev);

    return response;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text('Click button to start liveness'),
            TextButton(
                onPressed: () {
                  startSDK();
                },
                child: Text('Start Liveness'))
          ],
        ),
      ),
    );
  }
}