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_sdkas a dependency to thepubspec.yamlfile. We are currently on constant development for fine-tuning and improvement always refer to the latest release for the most up to date features and fixes.
dependencies:
aerosync_flutter_sdk: ^1.3.4
- Import the library
import 'package:aerosync_flutter_sdk/aerosync_flutter_sdk.dart';
2. Usage/Examples
The AeroSync SDK is launched as a new page in your application. The AerosyncSDKPage widget handles the platform-specific implementation automatically.
In this example, the widget is launched by pushing a new MaterialPageRoute when an ElevatedButton is pressed.
import 'package:flutter/material.dart';
import 'package:aerosync_flutter_sdk/aerosync_flutter_sdk.dart';
import 'dart:convert';
class MyApp extends StatelessWidget {
// Your app's state and build method
// ...
}
class MyFeature extends StatefulWidget {
@override
_MyFeatureState createState() => _MyFeatureState();
}
class _MyFeatureState extends State<MyFeature> {
final String _token = "YOUR_AEROSYNC_TOKEN"; // Replace with a valid token
final String _env = "sandbox";
final String? _deeplink = "myapp://connect"; // Required for mobile, can be null for web-only apps
void handleSuccess(EventType type, dynamic data) {
// The data is a JSON string, so we decode it.
final successData = jsonDecode(data);
print("AeroSync Success: ${successData['payload']}");
// Example: Store user_id and user_password
}
void handleClose(EventType type, dynamic data) {
print("AeroSync Closed");
}
void handleError(EventType type, dynamic data) {
print("AeroSync Error: $data");
}
void handleEvent(EventType type, dynamic data) {
print("AeroSync Event: $data");
}
void handleLoad(EventType type, dynamic data) {
print("AeroSync Loaded: $data");
}
@override
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AerosyncSDKPage(
env: _env,
token: _token,
deeplink: _deeplink,
style: const {"width": "378", "height": "688", "bgColor": "#FFFFFFFF"}, // Optional parameter - all properties (width, height, bgColor) have defaults if omitted
theme: 'dark',
onSuccess: handleSuccess,
onClose: handleClose,
onError: handleError,
onEvent: handleEvent,
onLoad: handleLoad,
),
),
);
},
child: const Text('Connect Bank Account'),
),
);
}
}
The SDK automatically dismisses the widget (calls Navigator.pop) when onSuccess or onClose fires. Do not call Navigator.pop inside these callbacks — it will cause a double-pop crash.
The AerosyncSDKPage widget takes in parameters to configure its behavior and callbacks to handle events from the AeroSync UI. To generate a token, check out our integration guide.
| Parameter | Type | Description |
|---|---|---|
env |
string |
Required. Available values: "sandbox", "production". |
token |
string |
Required. The token generated from the integration guide. |
style |
Map? |
Optional styling configuration for the widget container. Default: {}All properties are optional with defaults: • width: Widget width as string (default: "350", max: 375)• height: Widget height as string (default: "688", max: 688)• bgColor: Background color in ARGB hex format (default: "#FF949494" gray)Example: {"width": "375", "height": "688", "bgColor": "#FFFF0000"} (red background) |
theme |
string |
UI theme for the widget. Available values: 'light', 'dark'. Default: 'light'. |
onEvent |
function(response) |
Required. Triggered for various events as the user navigates the workflow. |
onLoad |
function(response) |
Required. Called once after the web contents have been initially loaded. |
onSuccess |
function(response) |
Required. Triggered when a bank is linked successfully. data is a JSON-encoded string — use jsonDecode(data) to parse it. See Store connected account. |
onClose |
function(response) |
Required. This method will be triggered when the Aerosync widget is closed. |
onError |
function(response) |
Required. Called if the AeroSync UI dispatches any error events. |
deeplink |
string? |
Required for mobile (iOS/Android). Your app's custom URL scheme (e.g. "myapp://connect"). Used to return the user to your app after an OAuth bank login. Not required for Flutter web. |
consumerId |
string? |
Unique ID that represents the client to apply the customization. Contact the team for more information." |
handleMFA |
bool? |
Boolean value that determines MFA widget invocation. Contact the team for more information." |
jobId |
string? |
Unique ID that represents the current MFA jobId. Contact the team for more information." |
userId |
string? |
Unique ID that represents the current MFA userId. Contact the team for more information." |
3. Deeplink setup (mobile only)
OAuth bank logins open in the system browser and redirect back to your app via a custom URL scheme. You must register your scheme in both platforms.
Android — android/app/src/main/AndroidManifest.xml:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" android:host="connect" />
</intent-filter>
iOS — ios/Runner/Info.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
</array>
Replace myapp and connect with the scheme and host from your deeplink parameter.
4. Flutter web
The SDK automatically uses an iframe when running in a browser — no additional setup required. The deeplink parameter is not needed for web-only apps.
Store connected account
Store onSuccess() data attributes to authenticate with the AeroSync API. The data value returned from the success callback is a JSON-encoded string. You can decode it using jsonDecode(data) to use it as a Map.
{
"type": "pageSuccess",
"payload": {
"user_id": "40a8b0b79cd742bc8a4384ddfc9244c0",
"user_password": "5e48cbb437de492992e0ebf854a8a404",
"ClientName": "Aeropay",
"FILoginAcctId": 113786059
}
}