scanovateplugin 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • new69

Flutter Scanovate Plugin #

A Flutter plugin for iOS and Android allowing access to the Scanovate API.

Installation #

First, add scanovateplugin as a dependency in your pubspec.yaml file.

dependencies: scanovateplugin: ^0.1.0

then import package

import 'package:scanovateplugin/scanovateplugin.dart';

the plugin returns the response in json string format.

iOS #

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 - Location When In Use Usage Description and a usage description.

Or in text format add the key:

<key>NSCameraUsageDescription</key>
<string>Use for liveness</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) requiere acceso a tu ubicación para realizar la verificación de identidad</string>

Change the target iOS version to 9 (or higher) in your PodFile

Change the minimum iOS version to 9 (or higher) in your project general tab

Run pod install or pod update if you already have run install

Android #

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

Example #

Here is a small example flutter app calling the plugin.

For use you have to provide valid data

import 'package:flutter/material.dart';  
import 'dart:async';  
import 'package:flutter/services.dart';  
import 'package:scanovateplugin/scanovateplugin.dart';
  void main() {  
  runApp(MyApp());  
}	 	 

class MyApp extends StatefulWidget {  
  @override  
  _MyAppState createState() => _MyAppState();  
}  

class _MyAppState extends State<MyApp> {  
  String _platformVersion = 'Unknown';  
  String _resultScanovate = '';  
  bool pressedValidate = false;  
 final documentNumberController = TextEditingController();  
 final individualFingerCode = TextEditingController();  
  
  String documentType = "3";  
  int productId = 1;  
  bool showLevelerUI = false;  
  String projectName = "Nombre proyecto";  
  String apiKey = "key api";  
  String urlSdk = "url sdk";  
  String documentNumber;  
  String codeFinger;  
  bool verification = false;  
  String _scanovateResult = "";  
  @override  
  void initState() {  
    super.initState();  
  initPlatformState();  
  }  
  
  // Platform messages are asynchronous, so we initialize in an async method.  
  Future<void> initPlatformState() async {  
    String platformVersion;  
  // Platform messages may fail, so we use a try/catch PlatformException.  
  try {  
      platformVersion = await Flutterscanovateplugin.platformVersion;  
  } on PlatformException {  
      platformVersion = 'Failed to get platform version.';  
  }  
  
    // If the widget was removed from the tree while the asynchronous platform  
 // message was in flight, we want to discard the reply rather than calling // setState to update our non-existent appearance.  if (!mounted) return;  
  
  setState(() {  
      _platformVersion = platformVersion;  
  });  
  }  
  
  Future<void> _scanovate(BuildContext context) async {  
    String response;  
  // Platform messages may fail, so we use a try/catch PlatformException.  
  try {  
      documentNumber = documentNumberController.text;  
  codeFinger = individualFingerCode.text;  
  response = await Flutterscanovateplugin.callScanovate(verification, documentType, productId, showLevelerUI, projectName, apiKey, urlSdk, documentNumber, codeFinger);  
  } on PlatformException {  
      response = 'Failed to get platform version.';  
  }  
  
    // If the widget was removed from the tree while the asynchronous platform  
 // message was in flight, we want to discard the reply rather than calling // setState to update our non-existent appearance.  if (!mounted) return;  
  
  _showAlert(response);  
  setState(() {  
      _resultScanovate = response;  
  });  
  }  
  final navigatorKey = GlobalKey<NavigatorState>();  
 void _showAlert(String message) {  
    final context = navigatorKey.currentState.overlay.context;  
  showDialog(  
        context: context,  
  builder: (context) => AlertDialog(  
          title: Text("Test"),  
  content: Text(message),  
  )  
    );  
  }  
  
  @override  
  Widget build(BuildContext context) {  
    return new MaterialApp(  
        navigatorKey: navigatorKey,  
  home: new Scaffold(  
        appBar: AppBar(  
          // Here we take the value from the MyHomePage object that was created by  
 // the App.build method, and use it to set our appbar title.  title: Text('Lanzador El Rosado'),  
  ),  
  body: Center(  
          // Center is a layout widget. It takes a single child and positions it  
 // in the middle of the parent.  child: Column(  
            // Column is also a layout widget. It takes a list of children and  
 // arranges them vertically. By default, it sizes itself to fit its // children horizontally, and tries to be as tall as its parent. // // Invoke "debug painting" (press "p" in the console, choose the // "Toggle Debug Paint" action from the Flutter Inspector in Android // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) // to see the wireframe for each widget. // // Column has various properties to control how it sizes itself and // how it positions its children. Here we use mainAxisAlignment to // center the children vertically; the main axis here is the vertical // axis because Columns are vertical (the cross axis would be // horizontal).  mainAxisAlignment: MainAxisAlignment.center,  
  children: <Widget>[  
              !pressedValidate ? RaisedButton(  
                onPressed: () {  
                  this.setState(() {  
                    pressedValidate = true;  
  });  
  },  
  textColor: Colors.white,  
  padding: const EdgeInsets.all(0.0),  
  child: const Text('Verificar', style: TextStyle(fontSize: 20)),  
  color: Color(0xFF0D47A1),  
  
  ): SizedBox(),  
  pressedValidate ? new Container(  
                  width: 300 ,  
  child:  
                  TextField(  
                      controller: documentNumberController,  
  obscureText: false,  
  keyboardType: TextInputType.number,  
  decoration: InputDecoration(  
                        border: OutlineInputBorder(),  
  labelText: 'Número de cédula',  
  )  
                  )  
              )  
                  : SizedBox(),  
  SizedBox(height: 40),  
  pressedValidate ? new Container(  
                  width: 300 ,  
  child:  
                  TextField(  
                      controller: individualFingerCode,  
  obscureText: false,  
  keyboardType: TextInputType.text,  
  decoration: InputDecoration(  
                        border: OutlineInputBorder(),  
  labelText: 'Código dactilar',  
  )  
                  )  
              )  
                  : SizedBox(),  
  SizedBox(height: 40),  
  pressedValidate ? RaisedButton(  
                onPressed: () {  
                  _scanovate(context);  
  },  
  textColor: Colors.white,  
  padding: const EdgeInsets.all(0.0),  
  child: const Text('Enviar', style: TextStyle(fontSize: 20)),  
  color: Color(0xFF0D47A1),  
  
  ): SizedBox(),  
  pressedValidate ? RaisedButton(  
                onPressed: () {  
                  this.setState(() {  
                    pressedValidate = false;  
  });  
  },  
  textColor: Colors.white,  
  padding: const EdgeInsets.all(0.0),  
  child: const Text('Volver', style: TextStyle(fontSize: 20)),  
  color: Color(0xFF0D47A1),  
  
  ): SizedBox()  
            ],  
  ),  
  ),  
  // This trailing comma makes auto-formatting nicer for build methods.  
  )  
    );  
  }  
  
  
}

0.1.3 #

  • Se ajusta el tamaño de la foto, que provocaba que el tamaño de la misma se sobrepusiera a los botones.

0.1.2 #

  • Se realizó ajuste del look and feel para evitar la sobre posición de los textos con el botón en pantallas pequeñas.
  • Tamaño de presentación de la selfie, salía pequeño en algunos dispositivos.
  • Se alinea texto “Volver a tomar” en el borde superior con el texto “Aceptar”
  • Se cambia de color negro a Gris #707070 el texto “Este proceso puede tomar unos minutos”

0.1.1 #

  • Fix for ios library to allow run on emulator and fix on camera handle

0.1.0 #

  • Document update and release.

0.0.2 #

  • Document and path fixes.

0.0.1 #

  • initial release.

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:scanovateplugin/scanovateplugin.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool pressedValidate = false;
  final documentNumberController = TextEditingController();
  final individualFingerCode = TextEditingController();

  String documentType = "3";
  int productId = 1;
  bool showLevelerUI = false;
  String projectName = "nombre proyecto";
  String apiKey = "api key";
  String urlSdk = "url sdk";
  String documentNumber;
  String codeFinger;
  bool verification = false;

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await Flutterscanovateplugin.platformVersion;
      log(platformVersion);
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;


  }

  Future<void> _scanovate(BuildContext context) async {
    String response;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      documentNumber = documentNumberController.text;
      codeFinger = individualFingerCode.text;
      response = await Flutterscanovateplugin.callScanovate(verification, documentType, productId, showLevelerUI, projectName, apiKey, urlSdk, documentNumber, codeFinger);
    } on PlatformException {
      response = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    _showAlert(response);

  }
  final navigatorKey = GlobalKey<NavigatorState>();
  void _showAlert(String message) {
    final context = navigatorKey.currentState.overlay.context;
    showDialog(
        context: context,
        builder: (context) => AlertDialog(
          title: Text("Test"),
          content: Text(message),
        )
    );
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
        navigatorKey: navigatorKey,
        home: new Scaffold(
        appBar: AppBar(
          // Here we take the value from the MyHomePage object that was created by
          // the App.build method, and use it to set our appbar title.
          title: Text('Lanzador El Rosado'),
        ),
        body: Center(
          // Center is a layout widget. It takes a single child and positions it
          // in the middle of the parent.
          child: Column(
            // Column is also a layout widget. It takes a list of children and
            // arranges them vertically. By default, it sizes itself to fit its
            // children horizontally, and tries to be as tall as its parent.
            //
            // Invoke "debug painting" (press "p" in the console, choose the
            // "Toggle Debug Paint" action from the Flutter Inspector in Android
            // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
            // to see the wireframe for each widget.
            //
            // Column has various properties to control how it sizes itself and
            // how it positions its children. Here we use mainAxisAlignment to
            // center the children vertically; the main axis here is the vertical
            // axis because Columns are vertical (the cross axis would be
            // horizontal).
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              !pressedValidate ? RaisedButton(
                onPressed: () {
                  this.setState(() {
                    pressedValidate = true;
                  });
                },
                textColor: Colors.white,
                padding: const EdgeInsets.all(0.0),
                child: const Text('Verificar', style: TextStyle(fontSize: 20)),
                color: Color(0xFF0D47A1),

              ): SizedBox(),
              pressedValidate ? new Container(
                  width: 300 ,
                  child:
                  TextField(
                      controller: documentNumberController,
                      obscureText: false,
                      keyboardType: TextInputType.number,
                      decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        labelText: 'Número de cédula',
                      )
                  )
              )
                  : SizedBox(),
              SizedBox(height: 40),
              pressedValidate ? new Container(
                  width: 300 ,
                  child:
                  TextField(
                      controller: individualFingerCode,
                      obscureText: false,
                      keyboardType: TextInputType.text,
                      decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        labelText: 'Código dactilar',
                      )
                  )
              )
                  : SizedBox(),
              SizedBox(height: 40),
              pressedValidate ? RaisedButton(
                onPressed: () {
                  _scanovate(context);
                },
                textColor: Colors.white,
                padding: const EdgeInsets.all(0.0),
                child: const Text('Enviar', style: TextStyle(fontSize: 20)),
                color: Color(0xFF0D47A1),

              ): SizedBox(),
              pressedValidate ? RaisedButton(
                onPressed: () {
                  this.setState(() {
                    pressedValidate = false;
                  });
                },
                textColor: Colors.white,
                padding: const EdgeInsets.all(0.0),
                child: const Text('Volver', style: TextStyle(fontSize: 20)),
                color: Color(0xFF0D47A1),

              ): SizedBox()
            ],
          ),
        ),
        // This trailing comma makes auto-formatting nicer for build methods.
      )
    );
  }


}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  scanovateplugin: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:scanovateplugin/scanovateplugin.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
39
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:scanovateplugin/scanovateplugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:scanovateplugin/scanovateplugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:scanovateplugin/scanovateplugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:scanovateplugin/scanovateplugin.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • scanovateplugin that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test