Flutter quickstart

  1. 1

    Add the dependency

    yaml
    # pubspec.yaml
    dependencies:
      neetix_liveliness:
        git:
          url: https://github.com/neetixai/liveliness-sdks.git
          path: packages/flutter
          ref: "0.2.0"
    bash
    flutter pub get
  2. 2

    Get a test key

    bash
    curl -X POST https://liveliness.neetix.in/v1/signup \
      -H 'Content-Type: application/json' \
      -d '{"email":"you@company.com"}'

    The client can also mint one with no auth at all:

    dart
    final s = await NeetixClient().signup('you@company.com');
    // s.apiKey is shown once — 1,000 free credits
    A key in a Flutter app is extractable

    Dart compiles to a bundle an attacker can read, on mobile and on web. Use a test key while building; in production mint short-lived keys from your own backend.

  3. 3

    Make the call

    dart
    import 'dart:io';
    import 'package:neetix_liveliness/neetix_liveliness.dart';
    
    final nx = NeetixClient(apiKey: 'YOUR_KEY');
    
    final selfie = await File('selfie.jpg').readAsBytes();
    final card = await File('id.jpg').readAsBytes();
    
    final res = await nx.faceMatch(selfie, card, clientRefId: 'application-4821');
    
    print(res.verdict);        // "approved" | "review" | "declined"
    print(res.isSameFace);
    print(res.warnings.length);

    With image_picker, the bytes come straight from the picked file:

    dart
    final picked = await ImagePicker().pickImage(source: ImageSource.camera);
    final selfie = await picked!.readAsBytes();
  4. 4

    Branch on the verdict

    dart
    switch (res.verdict) {
      case 'approved':
        continueJourney();
      case 'review':
        queueForReview(res.warnings);
      case 'declined':
        stop(res.warnings);
    }

Liveliness on its own

dart
final live = await nx.liveness(selfie);
print(live.status);          // "Approved" | "Declined" | "Not Finished"
print(live.livenessScore);

What else is available

MethodEndpointCredits
faceMatch(person, card, …)POST /v1/face/face-match2
liveness(person)POST /v1/liveness1
ageCheck(person)POST /v1/age1
authEnroll / authVerifyPOST /v1/auth/*1 each
faceEnroll / faceSearchPOST /v1/face/enroll, /search1 each
templateProtect / templateVerifyPOST /v1/template/*1 each
amlScreen(name, …)POST /v1/aml/screen1
kybValidate(gstin:, pan:, cin:)POST /v1/kyb/validate2
mrzParse(mrz)POST /v1/document/mrz1
documentId(back:, front:)POST /v1/document/id2
workflowRun(checks: …)POST /v1/workflow/run3
balance() / ledger(limit:)GET /v1/billing/*—

Next

  • Get started — verdicts, warnings and credits.
  • REST API — what the client calls underneath.