Git Product home page Git Product logo

ekyc-id-flutter's Introduction

image

EkycID SDK for Flutter

The EkycID Flutter SDK lets you build fantastic OCR and Face Recognition experienced in your Flutter app.

With one quick scan, your users will be able to extract information from thier identity cards, passports, driver licenses, license plate, vehicle registration, covid-19 vaccinate card, and any other document by government-issued.

EkycID is:

  • Easy to integrate into existing ecosystems and solutions through the use of SDKs that supported both native and hybrid applications.
  • Better for user experience being that the document detections and liveness checks are done directly offline on the device.
  • Great for cutting down operations cost and increasing efficiency by decreasing reliance on human labor and time needed for manual data entry.

EkycID can:

  • Extract information from identity documents through document recognition & OCR.
  • Verify whether an individual is real or fake through liveness detection, and face recognition.
  • Verify the authenticity of the identity documents by combining the power of document detection, OCR, liveness detection, and face recognition.

This Flutter SDK is a wrapper around our Native SDK (Android & iOS).

1. Requirements

iOS

  • Minimum iOS Deployment Target: 10.0
  • Xcode 13 or newer
  • Swift 5
  • EkycID only supports 64-bit architectures (x86_64 and arm64).

Android

  • minSdkVersion: 21
  • targetSdkVersion: 32
  • compileSdkVersion 32

2. Installation

2.1. Flutter Setup

To use this plugin, add ekyc_id_flutter as a dependency in your pubspec.yaml file.

dependencies:
  ...
  ekyc_id_flutter:

2.2 iOS Setup

Step 1: On iOS add the following to your Info.plist

<!-- Camera Access -->
<key>NSCameraUsageDescription</key>
<string>Camera Access for Scanning</string>

<!-- Microphone Access -->
<key>NSMicrophoneUsageDescription</key>
<string>Microphone for playing instructions audio.</string>

Step 2: Go to Project > Runner > Building Settings > Excluded Architectures > Any SDK > armv7

Step 3: Make adjustments to your Podfile as shown below.

# add this line:
$iOSVersion = '10.0'

post_install do |installer|
  # add these lines:
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=*]"] = "armv7"
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
  end
  
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    
    # add these lines:
    target.build_configurations.each do |config|
      if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
      end
    end
    
  end
end

2.3. Android Setup

No extra setup is needed.

3. Usage

Step 1: Setup URL to server.

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  EkycIDServices.instance.setURL("YOUR_SERVER_URL");
  runApp(MyApp());
}

Step 2: Setup EkycIDExpress Widget

We expose an easy to use widget called EkycIDExpress. It handles the logic behind identity document scanning and liveness detections for you. You only expects to provide a simple callback to handle the result. Below is how you can use it.

class HomeScreen extends StatefulWidget {
  const HomeScreen({Key? key}) : super(key: key);

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {

  Future<void> onKYCCompleted({
    required LivenessDetectionResult liveness,
    required DocumentScannerResult mainSide,
    DocumentScannerResult? secondarySide,
  }) async {
    print("== ACCESS RESULTS HERE ==");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: TextButton(
          onPressed: () async {
            await showCupertinoModalBottomSheet(
              context: context,
              builder: (BuildContext context) {
                return EkycIDExpress(
                  language: Language.KH,
                  onKYCCompleted: onKYCCompleted,
                );
              },
            );
          },
          child: Text("Start KYC"),
        ),
      ),
    );
  }
}

Step 3: Handle the results

In the onKYCCompleted callback, you will have access to an instance of LivenessDetectionResult, and two instances of DocumentScannerResult (One for each side of the document).

Step 3: Match Faces

You can perform a face compare between the face in the document and the face from liveness detection like below.

Future<void> onKYCCompleted({
  required LivenessDetectionResult liveness,
  required DocumentScannerResult mainSide,
  DocumentScannerResult? secondarySide,
}) async {
  
  ApiResult response = await EkycIDServices.instance.faceCompare(
    faceImage1: mainSide.faceImage,
    faceImage2: liveness.frontFace?.image,
  );

  print(response.data?) // match score
}

Step 4: Perform OCR

You can perform OCR on the document image like below.

Future<void> onKYCCompleted({
  required LivenessDetectionResult liveness,
  required DocumentScannerResult mainSide,
  DocumentScannerResult? secondarySide,
}) async {
  
  ApiResult response = await EkycIDServices.instance.ocr(
    image: mainSide.documentImage,
    objectType: mainSide.documentType
  );

  print(response.data?); // response object based on document type
}

4. License

© 2022 EKYC Solutions Co, Ltd. All rights reserved.

ekyc-id-flutter's People

Contributors

bunphy avatar chungphing avatar finamuune avatar khemraksa avatar menghang01 avatar socret360 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ekyc-id-flutter's Issues

Error on runtime with liveness detection widget

E/flutter (13957): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String, null cannot be cast to non-null type kotlin.String, , null)
E/flutter (13957): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
E/flutter (13957): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
E/flutter (13957): <asynchronous suspension>
E/flutter (13957): #2      LivenessDetectionController.start (package:ekyc_id_flutter/src/liveness_detection/liveness_detection_controller.dart:32:5)
E/flutter (13957): <asynchronous suspension>
E/flutter (13957): #3      _LivenessDetectionViewState.onPlatformViewCreated (package:ekyc_id_flutter/src/liveness_detection/liveness_detection_view.dart:72:5)
E/flutter (13957): <asynchronous suspension>
E/flutter (13957): 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.