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
Add the following to yourios/Podfile:
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.