Skip to main content
Portal provides Stablecoin Infrastructure for organizations and their users.

To integrate Portal, an organization adds a client library to their mobile app and a few server API endpoints.

Installation

Add the portal_flutter package to your Flutter project.

Setup

Add the following to your pubspec.yaml:
Then run:
The Portal Flutter SDK is a federated plugin with separate Android and iOS implementations.

Platform Configuration

Android

Add the following to your android/app/build.gradle:

iOS

Deployment target

The iOS implementation requires a deployment target of iOS 15.0 or higher. Set the iOS Deployment Target to 15.0 or higher in Xcode (Runner → General → Minimum Deployments), or with platform :ios, '15.0' in ios/Podfile if you use CocoaPods.

Swift Package Manager

Swift Package Manager is on by default from Flutter 3.44 onward, and requires no further setup — the plugin declares its own native dependencies and Xcode resolves them when you build. On earlier Flutter versions SPM is opt-in, so those projects fall back to CocoaPods and need the CocoaPods setup below. If SPM is turned off, re-enable it. flutter config applies to every project for your user account:
A project can also opt out on its own in pubspec.yaml, and that takes precedence over the flutter config setting — remove this block if the command alone has no effect:

CocoaPods

Only needed on Flutter versions before 3.44, or when Swift Package Manager has been disabled. In your app’s ios/Podfile, match the platform to the deployment target you set above and declare PortalSwift:
The tag must match the PortalSwift version the plugin depends on.
Do not add the pod 'PortalSwift' line while Swift Package Manager is enabled. It is already resolved by the plugin’s Swift package, so declaring it in the Podfile as well resolves it a second time, and the module and the Mpc.xcframework it vendors are both built and linked twice.

Initializing Portal

To initialize Portal in your application, call the initialize method with your Client API Key. The rpcConfig parameter is a map of CAIP-2 Chain IDs to their respective RPC URLs.

Optional Configuration

The initialize method accepts additional optional parameters:
For faster wallet generation, enable the usePreGeneratedWallet feature flag here—no other code changes are needed.
Now that we have our Portal instance, the next step is to generate wallets for your user. Let’s create them!
If you are using Client Session Tokens (CSTs), this hint is for you.When your user’s CST expires, all Portal SDKs will throw an error on the next MPC Operation the user makes (e.g. creating a wallet, backing up a wallet, recovering a wallet, or signing). That error will include a code SESSION_EXPIRED in the SDK methods, which you can use as an indicator to refresh your CST.