berbix_flutter

Creator: coderz1093

Last updated:

0 purchases

berbix_flutter Image
berbix_flutter Images

Languages

Categories

Add to Cart

Description:

berbix flutter

Berbix Flutter Plugin #
The Berbix Flutter Plugin is a Dart wrapper around the Berbix native mobile SDKs for Android and iOS. It enables customers of Berbix to quickly get up and running with best-in-class identity verification in a Flutter setting. If you're interested in using Berbix for identity verification and you are not already a customer, you can learn more at berbix.com.
Obtaining a client token #
In order to start integration, you will need to generate a short-lived client token. The Berbix Verify API needs to be integrated in your backend. See Create a Transaction documentation.
Add Dependency #
To begin we'll need to add berbix_flutter as a dependency to our project. You can accomplish this by executing:
flutter pub add berbix_flutter
copied to clipboard
from your project directory. That should update your pubspec.yml like so:
# Other Settings
# ...
dependencies:
flutter:
sdk: flutter
berbix_flutter: ^0.0.2
copied to clipboard
After we've updated our configuration, we can fetch the new packages by running:
flutter pub get
copied to clipboard
Integrating #
Once the dependencies have been fetched, we're ready to make use of the new package. First we'll import the package in the .dart file we'd like to start the Berbix flow from.
import 'package:berbix_flutter/berbix_flutter.dart';
copied to clipboard
Setting a client token #
Like any other Berbix SDK, the Flutter SDK requires a Client Token to perform a transaction on behalf of a user. You can review our Server Side Documentation for help on generating a client token.
Once you have a valid client token, you can pass that to the SDK like so:
// Replace with a valid token!
BerbixFlutter.setClientToken("client_token_for_session");
copied to clipboard
Completing a transaction #
Once the client token is in place, you can perform a transaction simply by calling
BerbixFlutter.startFlow();
copied to clipboard
At this point, the SDK will handle navigation until the user either completes or cancels the verification flow.
Handling Errors / Exceptions #
When setting a client token, you may encounter a BerbixMissingClientTokenError if the client token is omitted. If the token was present, but there was a problem with it, you'll see BerbixInvalidClientTokenException instead.
try {
var result = await BerbixFlutter.setClientToken("your-client-token-here");
} on BerbixMissingClientTokenError catch (error) {
// We forgot to add the client token
} catch (error) {
// Something went wrong else where
FlutterError.presentError(error);
}
copied to clipboard
While presenting a flow, you may encounter other exceptions, which can be caught like so:
try {
var result = await BerbixFlutter.startFlow();
} catch (error) {
// Something went wrong while completing the flow
FlutterError.presentError(error);
// The area of the error is in error.code ("user", "api", "camera", "state", "berbix")
// A detailed error message is available in error.details
}
copied to clipboard
While you shouldn't have to worry about the types of errors per platform it's worthwhile to review the types of errors that can be generated by our iOS and Android SDKs, as the Flutter Plugin will merely return wrapped versions of these.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.