aerosync_flutter_sdk 0.0.1 aerosync_flutter_sdk: ^0.0.1 copied to clipboard
This Flutter SDK provides an interface to load Aerosync-UI in Flutter apps through flutter_inappwebview. Securely link your bank account through your bank’s website. Log in with a fast, secure, and to [...]
Introduction #
This Flutter SDK provides an interface to load Aerosync-UI in Flutter apps through flutter_inappwebview. Securely link your bank account through your bank’s website. Log in with a fast, secure, and tokenized connection. Your information is never shared or sold.
1. Installation #
-
First add
aerosync_flutter_SDK
as a dependency to thepubspec.yaml
file. -
Import the library
import 'package:aerosync_flutter_SDK/aerosync_flutter_SDK.dart';
2. Usage/Examples #
The Aerosync plugin is brought in as a separate window that launches the Flutter InAppWebView Plugin with the aerosync starting url.
In this example the widget is navigated to when ElevatedButton
is pressed.
...
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: isLoading
? LaunchButton(env: _env, token: _token)
: SizedBox(), // this includes all the button and functionality
),
);
}
...
class LaunchButton extends StatelessWidget {
var env;
var token;
LaunchButton({Key? key, required this.env, required this.token})
: super(key: key);
// handle the OnEvent callback from aerosync
handleOnEventAerosync(eventType, data) {
print("CALLBACK FULLY HANDLED: OnEvent");
}
// handle the OnSuccess callback from aerosync
handleOnSuccessAerosync(eventType, data) {
print("CALLBACK FULLY HANDLED: OnSuccess");
}
// handle the OnClose callback from aerosync
handleOnCloseAerosync(eventType, data) {
print("CALLBACK FULLY HANDLED: OnClose");
}
// handle the OnLoad callback from aerosync
handleOnLoadAerosync(eventType, data) {
print("CALLBACK FULLY HANDLED: OnLoad");
}
// handle the OnError callback from aerosync
handleOnErrorAerosync(eventType, data) {
print("CALLBACK FULLY HANDLED: OnError");
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
ElevatedButton(
onPressed: () => {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => AerosyncSDKPage(
env: env,
token: token,
onEvent: handleOnEventAerosync,
onSuccess: handleOnSuccessAerosync,
onClose: handleOnCloseAerosync,
onLoad: handleOnLoadAerosync,
onError: handleOnErrorAerosync,
)))
},
child: Text(
'Connect',
style: TextStyle(fontSize: 20),
),
),
],
));
}
}
The AerosyncSDKPage
widget takes in a env
parameter, a token
parameter and callback event notifications needed for your implementation. To generate a token, check out our integration guide here.
Each callback returns an eventType
value and data that is returned from aerosync-ui.
Parameter | Type | Description |
---|---|---|
env |
string |
Required. Available values: dev, staging, prod. |
onEvent |
function(response) |
Required. This method will be triggered as the user completes the bank link workflow. |
onLoad |
function(response) |
Required. Call function after the contents of webpage have been loaded as the user completes the bank link workflow. |
onSuccess |
function(response) |
Required. This method will be triggered when a bank is added successfully and the user clicks on "continue" button in the final AeroSync-UI page. |
onClose |
function(response) |
Required. This method will be triggered when the aerosync widget is closed. |
onError |
function(response) |
Required. The method is called if AeroSync-UI dispatches any error events. |
Store connected account #
Store onSuccess() data attributes to authenticate with the Aerosync API to retrieve account information.
{
"payload": {
"ClientName": "client3",
"FILoginAcctId": "{\"u_guid\":\"USR-701a457e-5b93-4598-b7a1-b968c495ee3f\", \"m_guid\": \"MBR-d699c457-90f7-4b96-96c1-c50a445eabec\", \"a_guid\": \"ACT-9f5549d6-e402-43f4-8351-cd4018de7a80\"}",
"user_id": "a2c7f64f-3df9-4090-b3bd-ad6fc3003c90",
"user_password": "735e33b9-78ec-4887-99d7-a3056997ceb9" },
"type": "pageSuccess"
}