Flutter SDK v1.3.4 (legacy)

🚧

This page documents SDK v1.3.4 (legacy)

This is the archived API reference for aerosync_flutter_sdk: ^1.3.4. New integrations should use the current SDK — see Flutter SDK for v2.1.1 docs, or Migrating from v1.x if you're upgrading an existing app.

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

  1. Add aerosync_flutter_sdk as a dependency to the pubspec.yaml file:
dependencies:
  aerosync_flutter_sdk: ^1.3.4
  1. 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 — 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.

ParameterTypeDescription
envstringRequired. Available values: "sandbox", "production".
tokenstringRequired. The token generated from the integration guide.
styleMap?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)
themestringUI theme for the widget. Available values: 'light', 'dark'. Default: 'light'.
onEventfunction(response)Required. Triggered for various events as the user navigates the workflow.
onLoadfunction(response)Required. Called once after the web contents have been initially loaded.
onSuccessfunction(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.
onClosefunction(response)Required. Triggered when the AeroSync widget is closed.
onErrorfunction(response)Required. Called if the AeroSync UI dispatches any error events.
deeplinkstring?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.
consumerIdstring?Unique ID that represents the client to apply customization. Contact the team for more information.
handleMFAbool?Boolean value that determines MFA widget invocation. Contact the team for more information.
jobIdstring?Unique ID that represents the current MFA jobId. Contact the team for more information.
userIdstring?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 on 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 the onSuccess() data attributes to authenticate with the AeroSync API. The data value returned from the success callback is a JSON-encoded string. Decode it with jsonDecode(data) to use it as a Map.

{
  "type": "pageSuccess",
  "payload": {
    "user_id": "40a8b0b79cd742bc8a4384ddfc9244c0",
    "user_password": "5e48cbb437de492992e0ebf854a8a404",
    "ClientName": "Aeropay",
    "FILoginAcctId": 113786059
  }
}

Did this page help you?