blusalt_identity 0.0.1-dev.5

Flutter Android iOS

Blusalt Flutter package for accessing Identity services on Blusalt services API.

blusalt_identity #

Dart CI

Blusalt Flutter package for accessing Blusalt Identity Verification Services

Developers Preview Status #

The Package is a pre-release , all issues should be logged in Issues.

Usage #

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

Getting Started #

import 'package:blusalt_identity/network/blusalt_sdk.dart';
import 'package:blusalt_identity/network/network_client.dart';

// Initialize the SDK with your Credentials
ApiCredentials credentials = ApiCredentials(
    apiKey: MY_API_KEY,
    clientID: MY_CLIENT_ID, 
    appName: MY_APP_NAME
  );
  var future = BlusaltSDK.initializeSDK(credentials);
  future.then((onValue){
    print(onValue);
  })
  .catchError((onError){
   // print(onError);
  });

Sample Usage #

import 'package:blusalt_identity/network/blusalt_sdk.dart';
import 'package:blusalt_identity/network/network_client.dart';
import 'package:blusalt_identity/verification_manager.dart' as manager;

/// Verify BVN
void verifyBVN(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  BVNRequest bvnRequest = BVNRequest(bvnNumber: "bvn", phoneNumber: "phone number");
  var response = manager.verifyBVN(bvnRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as BVNResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
    print((onError as NetworkResponseError).message);
    //print("Error: ${(onError as BlusaltException).errorMessage()} ");
    // showToast(context, onError.toString());
  });
}

void verifyPVC(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  PVCRequest pvcRequest = PVCRequest(
      pvcNumber: "pvc number",
      phoneNumber: "phone number",
      lastName: "last_name",
      state: "lagos");
  Future<dynamic> future;
  var response = manager.verifyPVC(pvcRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as PVCResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
    //print("Error: ${(onError as NetworkResponseError).message}");
    // showToast(context, onError.toString());
  });
}

void verifyNIN(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  NINRequest ninRequest =
      NINRequest(ninNumber: "nin", phoneNumber: "phone number");
  var response = manager.verifyNIN(ninRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as NINResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
    print("Error: ${(onError as NetworkResponseError).code}");
    // showToast(context, onError.toString());
  });
}

void verifyNIP(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  NIPRequest nipRequest =
      NIPRequest(passportNumber: "doc number", phoneNumber: "phone number");
  var response = manager.verifyNIP(nipRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as NIPResponse).results.serviceType);
  }).catchError((onError) {
    print(onError);
    //_progressDialog.dismiss();
    //print(onError.runtimeType);
    // showToast(context, onError.toString());
  });
}

void verifyDL(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  DLRequest dlRequest = DLRequest(dlNumber: "dl_number", phoneNumber: "phone number");
  var response = manager.verifyDriversLicence(dlRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as NINResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
  });
}


0
likes
60
pub points
0%
popularity

Blusalt Flutter package for accessing Identity services on Blusalt services API.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

blusaltdev@gmail.com

License

Apache 2.0 (LICENSE)

Dependencies

build_runner, built_value_generator, flutter, http, http_interceptor, json_annotation, json_serializable, meta, mockito

More

Packages that depend on blusalt_identity