# Vlens KYC Mobile SDK

## Introduction :

Vlens KYC Package is a Flutter package that provides a simple and easy-to-use way to verify the identity of a user. The package takes a picture of the user's ID (front and back) and a selfie, and then uses advanced machine learning algorithms to verify that the ID is real and that the selfie matches the person in the ID.

The package is useful for a variety of applications, such as:

KYC/AML compliance Fraud prevention User onboarding Age verification The package is easy to use and can be integrated into any Flutter app with just a few lines of code

### 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
</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 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:vlens/vlens.dart';

class VlensTrail extends StatefulWidget {
  @override
  _VlensTrailState createState() => _VlensTrailState();
}

class _VlensTrailState extends State<VlensTrail> {
  UploadPhotosResponseModel select = UploadPhotosResponseModel();

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                GestureDetector(
                  onTap: () async {
                    // Here is how to start the package. This function will
                    // start the package and in the UploadPhotosResponseModel you will
                    // get all the data you need, such as name, ID number, and
                    // more.
                    UploadPhotosResponseModel s = await Vlens.instance
                        .startVlensFlow(
                            context: context, apiKey: "add your API key here",language: Language.arabic);
                    setState(() {
                      select = s;
                    });
                  },
                  child: const Text("start vlens"),
                ),
                    select.data != null ? Column(
                  children: [
                    Text(select.data!.name ?? "" ),
                    Text(select.data!.idNumber ?? "" ),
                  select.data!.frontIdPicture!=null? ShowBase64Image(base64Image: select.data!.frontIdPicture!):SizedBox.shrink(),
                  select.data!.backIdPicture!=null? ShowBase64Image(base64Image: select.data!.backIdPicture!):SizedBox.shrink(),
                select.data!.faceMatchingPicture!=null? ShowBase64Image(base64Image: select.data!.faceMatchingPicture!):SizedBox.shrink(),
                  ],
                ):SizedBox.shrink(),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
class ShowBase64Image extends StatelessWidget {
  final String base64Image;

  const ShowBase64Image({Key? key, required this.base64Image}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Convert the base64 string to a Uint8List.
    final Uint8List imageBytes = base64Decode(base64Image);

    // Create a dart:ui.Image object from the Uint8List.
    final Image image = Image.memory(imageBytes);

    return SizedBox(
      height: 150,
      width: 150,
      child: Card(
        child: ClipRRect(
          borderRadius: BorderRadius.circular(5),
          child: image,
        ),
      ),
    );
  }
}
```


---

# 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-kyc-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.
