# Vlens liveness Mobile SDK

## Introduction :

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  :

1. **Look Left:** Turn to the left to initiate the verification process.
2. **Look Right:** Turn  to the right to initiate the verification process.
3. **Blink:** A quick blink of your eyes confirms your presence.
4. **Smile:** Flash a genuine smile to seal the deal.

and if the user succeed that will verify liveliness.

### Installation:

#### #iOS

Add two rows to the ios/Runner/Info.plist file:

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:

```xml
<key>NSCameraUsageDescription</key>
<string>your usage description here</string>
```

#### #Android

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:

```xml
<uses-permission android:name="android.permission.INTERNET"/>
```

Copy the package file provided by vlens to your app folder.

Add the package in pubspec.yaml file under the dependencies :

<pre class="language-yaml"><code class="lang-yaml"><strong>dependencies:
</strong>  flutter:
    sdk: flutter 
  vlens: 
    path: packages/vlens_livness
</code></pre>

Run the following command to install the package: flutter pub get

Once you have completed these steps, you will be able to use the VLens package in your Flutter app.

#### Example :

```dart
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.
    );
  }
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.vlens.co/vlens-liveness-mobile-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
