> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> Follow this guide to integrate Portal in your Flutter app.

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`:

```yaml theme={null}
dependencies:
  portal_flutter: ^LATEST_VERSION
```

Then run:

```bash theme={null}
flutter pub get
```

<Note>
  The Portal Flutter SDK is a federated plugin with separate Android and iOS implementations.
</Note>

## Platform Configuration

### Android

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

```gradle theme={null}
android {
    defaultConfig {
        minSdk = 26
    }
}
```

### iOS

Add the following to your `ios/Podfile`:

```ruby theme={null}
platform :ios, '15.0'

# Add the PortalSwift dependency
pod 'PortalSwift', '~> 6.7', :git => 'https://github.com/portal-hq/PortalSwift.git'
```

## 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](../../../resources/chain-id-formatting#caip-2-chain-id-format) to their respective RPC URLs.

```dart theme={null}
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

await portal.initialize(
  apiKey: 'YOUR_CLIENT_API_KEY',
  rpcConfig: {
    'eip155:1': 'https://api.portalhq.io/rpc/v1/eip155/1',
    'eip155:10143': 'https://api.portalhq.io/rpc/v1/eip155/10143',
    'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'https://api.mainnet-beta.solana.com',
    'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1': 'https://api.devnet.solana.com',
  },
);
```

### Optional Configuration

The `initialize` method accepts additional optional parameters:

```dart theme={null}
await portal.initialize(
  apiKey: 'YOUR_CLIENT_API_KEY',
  rpcConfig: { /* ... */ },
  autoApprove: true,  // Auto-approve transactions without user confirmation
  apiHost: 'api.portalhq.dev',  // Custom API host for staging
  mpcHost: 'mpc.portalhq.dev',  // Custom MPC host for staging
);
```

Now that we have our Portal instance, the next step is to generate wallets for your user. Let's create them!

<Note>
  If you are using [Client Session Tokens (CSTs)](../../../resources/authentication-and-api-keys), 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.
</Note>
