To integrate Portal, an organization adds a client library to their mobile app and a few server API endpoints.
Installation
Add theportal_flutter package to your Flutter project.
Setup
Add the following to yourpubspec.yaml:
The Portal Flutter SDK is a federated plugin with separate Android and iOS implementations.
Platform Configuration
Android
Add the following to yourandroid/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 withplatform :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:
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’sios/Podfile, match the platform to the deployment target you set above and
declare PortalSwift:
PortalSwift version the plugin depends on.
Initializing Portal
To initializePortal 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
Theinitialize method accepts additional optional parameters:
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.