biopassid_flutter 0.1.9 copy "biopassid_flutter: ^0.1.9" to clipboard
biopassid_flutter: ^0.1.9 copied to clipboard

discontinuedreplaced by: biopassid_face_sdk
PlatformAndroidiOS

BioPassID flutter plugin.

biopassid_flutter #

Table of Contents #

Quick Start Guide #

Check out our official documentation for more in depth information on BioPass ID.

1. Install BioPass ID #

Android #

Change the minimum Android sdk version to 23 (or higher) in your android/app/build.gradle file.

minSdkVersion 23

Add the following in your android/app/src/main/AndroidManifest.xml file.

<manifest
    ...
    xmlns:tools="http://schemas.android.com/tools">
   <application
        ...
        tools:replace="android:label">
    </application>
</manifest>

Change the Kotlin version to 1.5.32 (or higher) in your android/build.gradle file.

buildscript {
    ext.kotlin_version = '1.5.32'
}

Add the following in your android/app/build.gradle file.

android {
    viewBinding {
        enabled = true
    }
}

Change the Gradle plugin version to 7.0.3 (or higher) in your android/build.gradle file.

android {
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.3'
    }
}

Change the Gradle version to 7.0.2 (or higher) in your android/gradle/wrapper/gradle-wrapper.properties file.

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

IOS #

The BioPassID plugin functionality works on iOS 13.0 or higher.

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

  • one with the key Privacy - Camera Usage Description and a usage description.
  • and one with the key Privacy - Photo Library Usage Description and a usage description.

Or in text format add the key:

<key>NSCameraUsageDescription</key>
<string>Your camera usage description</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Your library usage description</string>

Then go into your project's ios folder and run pod install.

# Go into ios folder
$ cd ios

# Install dependencies
$ pod install

2. Initialize BioPass ID #

To call BioPassID in your Flutter project is as easy as follow:

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

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final biopassid = BioPassID();
  final config =
      BioPassIDConfigPreset.getConfig(BioPassIDConfigType.FACE_DETECTION)
          .setQualityApiKey('your-quality-apiKey')
          .setIcao(true)
          .setDefaultCameraPosition(CameraLensDirection.BACK)
          .setShowFlipCameraButton(false)
          .setScreenTitle("Validando Face")
          .setOverlayColor(const Color(0xCC000000));

  void openCamera() async {
    await biopassid.buildCameraView(
      biopassidConfig: config,
      callback: handleBioPassIdEvent,
    );
  }

  void handleBioPassIdEvent(BioPassIDEvent event) {
    // handle BioPassID return
    print('event: $event');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Teste Plugin'),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: openCamera,
          child: const Text('BioPassId'),
        ),
      ),
    );
  }
}

BioPassIDConfig #

You can also use pre-build configurations on your application, so you can automatically start using multiples services and features that better suit your application. You can instantiate each one and use it's default properties, or if you prefer you can change every config available. Here are the types that are supported right now:

DefaultBioPassIDConfig #

Variable name Type Default value
apiKey Map<String, String> {'multibiometrics': '', 'quality': ''}
cameraPreset CameraPreset CameraPreset.FACE_FRONT
defaultCameraPosition CameraLensDirection CameraLensDirection.FRONT
showCaptureButton bool true
showFlashButton bool false
showFlipCameraButton bool true
flashEnabledByDefault bool false
showHelpText bool false
icao bool false
spoofing bool false
strings BioPassIDStrings
styles BioPassIDStyles

FaceDetectionBioPassIDConfig #

Variable name Type Default value
apiKey Map<String, String> {'multibiometrics': '', 'quality': ''}
cameraPreset CameraPreset CameraPreset.FACE_FRONT
defaultCameraPosition CameraLensDirection CameraLensDirection.FRONT
showCaptureButton bool true
showFlashButton bool false
showFlipCameraButton bool true
flashEnabledByDefault bool false
showHelpText bool true
icao bool false
spoofing bool false
strings BioPassIDStrings
styles BioPassIDStyles

LivenessDetectionBioPassIDConfig #

Variable name Type Default value
apiKey Map<String, String> {'multibiometrics': '', 'quality': ''}
cameraPreset CameraPreset CameraPreset.FACE_FRONT
defaultCameraPosition CameraLensDirection CameraLensDirection.FRONT
showCaptureButton bool false
showFlashButton bool false
showFlipCameraButton bool false
flashEnabledByDefault bool false
showHelpText bool true
icao bool false
spoofing bool false
strings BioPassIDStrings
styles BioPassIDStyles

BioPassIDStrings #

Variable name Type
screenTitle String
helpText String

BioPassIDStyles #

Variable name Type Default value
faceColor Color Color(0xFFFFFFFF)
overlayColor Color Color(0xCC000000)
flashButtonEnabledColor Color Color(0xFFFFCC01)

CameraPreset #

Preset Type Resolution
CameraPreset.FACE_FRONT 640x480
CameraPreset.LIVENESS 640x480

CameraLensDirection (enum) #

Name
CameraLensDirection.FRONT
CameraLensDirection.BACK

How to instantiate and functionalities #

To instantiate it's easy as to do one function call (as we have seen previously on the example). You only need to specify which type of config you want using a ENUM BioPassIDConfigType. Every type however can have different features implemented, here are the supported types:

Config Type Enum feature
Face BioPassIDConfigType.FACE_DETECTION Capture still image and detects face
Liveness BioPassIDConfigType.LIVENESS_DETECTION Capture every frame per second

BioPassIDEvent #

On your BioPassID callback function, you receive a BioPassIDEvent.

BioPassIDEvent #

Name Type
photo Uint8List
icao IcaoResponse
spoof FaceSpoofResponse

FaceSpoofResponse #

Name Type
success bool
result String
spoof bool

IcaoResponse #

Name Type
faceImageConformed int
isAllConformed bool
requirements RequirementsICAOResponse

RequirementsICAOResponse #

Name Type
blurred ResultCheckICAOResponse
lookingAway ResultCheckICAOResponse
inkMarked ResultCheckICAOResponse
unnaturalSkin ResultCheckICAOResponse
tooDarkLight ResultCheckICAOResponse
washedOut ResultCheckICAOResponse
pixelation ResultCheckICAOResponse
hairAcrossEyes ResultCheckICAOResponse
eyesClosed ResultCheckICAOResponse
variedBackground ResultCheckICAOResponse
roll_Pitch_Yaw ResultCheckICAOResponse
flashReflectionOnSkin ResultCheckICAOResponse
redEyes ResultCheckICAOResponse
shadowsBehindHead ResultCheckICAOResponse
shadowsAcrossFace ResultCheckICAOResponse
darkTintedLenses ResultCheckICAOResponse
flashReflectionOnLenses ResultCheckICAOResponse
framesTooHeavy ResultCheckICAOResponse
framesCoveringEyes ResultCheckICAOResponse
hat_Cap ResultCheckICAOResponse
veilOverFace ResultCheckICAOResponse
mouthOpen ResultCheckICAOResponse
otherFaces ResultCheckICAOResponse

ResultCheckICAOResponse #

Name Type
isConformed bool
confidence double

Changelog #

v0.1.9 #

  • Configuration and Integration with BioPassID SDK Android and IOS v0.1.9
  • New flashButtonEnabledColor attribute in BioPassIDStyles

License #

This project is under the MIT license. See the LICENSE for more information.