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

# Get Started

> Install the Crossmint Flutter SDK and set up the client and wallet controller

### Latest Flutter SDK version - [![pub.dev](https://img.shields.io/pub/v/crossmint_flutter)](https://pub.dev/packages/crossmint_flutter)

The Crossmint Flutter SDK (`crossmint_flutter`) provides a headless-first SDK with optional UI widgets for integrating Crossmint wallets and authentication into your Flutter application.

## Installation

```bash theme={null}
flutter pub add crossmint_flutter
```

## Client Setup

Initialize the `CrossmintClient` and set up authentication and wallet management. The controllers barrel re-exports the client and auth surfaces, so a single import is enough:

```dart main.dart theme={null}
import 'package:crossmint_flutter/crossmint_flutter_controllers.dart';

final client = CrossmintClient(
  config: CrossmintClientConfig(
    apiKey: 'YOUR_CLIENT_API_KEY',
    appScheme: 'YOUR_APP_SCHEME',
  ),
);

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await client.initialize();
  await client.auth.restoreSession();
  runApp(const MyApp());
}
```

## Provider Setup (Optional UI)

For apps using the provider pattern, wrap your application with `CrossmintWalletProvider`. Provider mode manages its own `CrossmintClient` internally — skip the [Client Setup](#client-setup) step above if you only use the provider.

```dart main.dart theme={null}
import 'package:flutter/material.dart';
import 'package:crossmint_flutter/crossmint_flutter_ui.dart';

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: CrossmintWalletProvider(
        config: CrossmintWalletProviderConfig(
          clientConfig: CrossmintClientConfig(
            apiKey: 'YOUR_CLIENT_API_KEY',
            appScheme: 'YOUR_APP_SCHEME',
          ),
          walletControllerConfig: CrossmintWalletControllerConfig(
            createOnLogin: CrossmintCreateOnLoginConfig(
              chain: 'base-sepolia',
              recovery: const CrossmintEmailSignerConfig(),
            ),
            showOtpSignerPrompt: true,
          ),
        ),
        child: const HomeScreen(),
      ),
    );
  }
}
```

## Quick Example

Once the client is set up, use the wallet controller directly (headless) to access wallet state and react to status changes via `addListener`:

```dart theme={null}
import 'package:crossmint_flutter/crossmint_flutter_controllers.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';

final client = CrossmintClient(
  config: CrossmintClientConfig(
    apiKey: 'YOUR_CLIENT_API_KEY',
    appScheme: 'YOUR_APP_SCHEME',
  ),
);

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await client.initialize();
  await client.auth.restoreSession();

  final walletController = client.createWalletController(
    CrossmintWalletControllerConfig(
      createOnLogin: CrossmintCreateOnLoginConfig(
        chain: 'base-sepolia',
        recovery: const CrossmintEmailSignerConfig(),
      ),
      showOtpSignerPrompt: true,
    ),
  );

  walletController.addListener(() {
    final wallet = walletController.currentWallet;
    if (wallet != null) {
      debugPrint('Address: ${wallet.address}');
      debugPrint('Chain: ${wallet.chain}');
    }
  });
}
```

Or using the provider pattern with widgets:

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

class WalletInfo extends StatelessWidget {
  const WalletInfo({super.key});

  @override
  Widget build(BuildContext context) {
    return CrossmintWalletStatusBuilder(
      builder: (context, data) {
        if (data.state.walletStatus == CrossmintWalletStatus.inProgress) {
          return const CircularProgressIndicator();
        }
        final wallet = data.state.currentWallet;
        if (wallet == null) {
          return const Text('No wallet loaded');
        }
        return Column(
          children: [
            Text('Address: ${wallet.address}'),
            Text('Chain: ${wallet.chain}'),
          ],
        );
      },
    );
  }
}
```

## Headless vs UI Imports

The Flutter SDK follows a headless-first design. Most apps only need the default barrel; reach for the granular barrels when you want to narrow the surface:

| Import | Description |
| - | - |
| `crossmint_flutter.dart` | Default headless entry point — re-exports client, auth, wallets, controllers, and runtime |
| `crossmint_client.dart` | Core client and configuration |
| `crossmint_flutter_auth.dart` | Authentication client and models |
| `crossmint_flutter_wallets.dart` | Wallet models and signer configs |
| `crossmint_flutter_controllers.dart` | Wallet controller (ChangeNotifier) |
| `crossmint_flutter_runtime.dart` | Runtime wallet classes (EVM, Solana, Stellar) |
| `crossmint_flutter_ui.dart` | Optional UI widgets (pulls in Material) |

## Next Steps

* [Providers](https://docs.crossmint.com/sdk-reference/wallets/flutter/providers.md) — Configure providers and scopes
* [Controllers](https://docs.crossmint.com/sdk-reference/wallets/flutter/controllers.md) — Manage wallet and auth state
* [Widgets](https://docs.crossmint.com/sdk-reference/wallets/flutter/widgets.md) — Optional UI widgets
* [Wallet Methods](https://docs.crossmint.com/sdk-reference/wallets/flutter/controllers.md#wallet-methods) — Send tokens, check balances, sign messages
