Vlens liveliness Package is a Flutter package that provides a simple and easy-to-use way to verify the liveliness of a user. The package takes 3 of these posses :
and if the user succeed that will verify liveliness.
One with the key Privacy - Camera Usage Description and a usage description. If editing Info.plist as text, add: NSCameraUsageDescription your usage description here add:
Copy <key>NSCameraUsageDescription</key>
<string>your usage description here</string>
Change the minimum Android SDK version to 21 (or higher) in your android/app/build.gradle file. minSdkVersion 21
Add the following permission to your app's manifest, located at android/app/src/main/AndroidManifest.xml:
Copy <uses-permission android:name="android.permission.INTERNET"/>
Copy the package file provided by vlens to your app folder.
Copy dependencies:
flutter:
sdk: flutter
vlens:
path: packages/vlens_livness
Once you have completed these steps, you will be able to use the VLens package in your Flutter app.
Copy import 'package:flutter/material.dart';
import 'package:vlens_livness/vlens_livness.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key,});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
LivnessMultiModel select = LivnessMultiModel();
TextEditingController accountNameController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text("Vlens Livness"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Column(
children: [
ElevatedButton(onPressed: () async {
LivnessMultiModel s = await Vlens.instance
.startVlensFlow(
context: context,
apiKey:
"add your API key here",
transactionId: "add Transaction Id her"
);
setState(() {
select = s;
});
}, child: Text(
'start livness',
style: Theme.of(context).textTheme.headlineMedium,
),
),
select.data != null ?
Column(
children: [
Text("liveness :${select.data!.liveness !=null ?select.data!.liveness.toString(): "null"}"),
Text("isMatched :${select.data!.isMatched !=null ?select.data!.isMatched.toString(): "null"}"),
Text("detectedFaces :${select.data!.detectedFaces !=null ?select.data!.detectedFaces.toString(): "null"}"),
Text("detectedIdFace :${select.data!.detectedIdFace !=null ?select.data!.detectedIdFace.toString(): "null"}"),
Text("transactionId :${select.data!.transactionId ?? "null"}"),
],
)
: SizedBox.shrink(),
select.errorCode!=null? Text("errorCode :${select.errorCode }"): SizedBox.shrink(),
],
)
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}