Flutter Integration
Integration guide for Integration PFM Stack in Flutter Application
PFM Stack provides an Embedded Flutter SDK that allows you to integrate a Personal Finance Management experience into your flutter application with minimal effort. With just a few lines of code, you can enable users to aggregate all their financial data in one place using the Account Aggregator framework.
Step-by-Step Integration
Step 1: Initialization of SDK API
When a consumer wants to open PFM, your backend service must trigger the initialisation of SDK API.
Follow the Initialize Transaction API guide to integrate with the API in your backend server.
Step 2: Add SDK as dependency
Add the following dependency to your pubspec.yaml file:
# Add the PFM SDK as dependency
dependencies:
pfm_sdk_flutter:
git:
url: https://github.com/inifity-tech/pfm_flutter_sdk.git
Run the following command to fetch the dependency:
flutter pub get
Step 3: Launch PFM SDK
Once the transaction is initialised, the PFM Stack UI can be opened by the client. Follow these steps to integrate and launch PFM Stack UI through the Flutter SDK.
Modify AndroidManifest.xml
Add the following to the android/src/main/AndroidManifest.xml file:
<provider
android:name="com.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFileProvider"
android:authorities="${applicationId}.flutter_inappwebview_android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
Launch the PFM Stack SDK
import 'package:pfm_sdk_flutter/pfm_sdk_flutter.dart';
import 'package:pfm_sdk_flutter/model/pfm_sdk_params.dart';
void launchPFMStackUI(BuildContext context) {
PFMSDK.instance.launchSDK(
context: context,
pfmSdkConfig: PFMSDKConfig(
token: "#token",
env: "#env"
),
onClosed: (data) {
// handle success response
},
onError: (data) {
//handle error response
},
);
}
SDK Parameters
Parameter | Mandatory/Optional | Description |
---|---|---|
token | Mandatory | Generated and shared in response from Step 1 - Response of Initialise API |
env | optional | sandbox is Default. Pass "production" to point to production - Ensure this variable is environment specific. |
SDK Callback Methods
The launchSDK method of PFMSDK accepts the following callbacks methods:
- onError: this is Invoked by SDK when
- There are failures in opening the UI
- onClosed: Invoked when the SDK is closed by the user.
Updated about 2 months ago