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.
The Crossmint Flutter SDK (crossmint_flutter) provides a headless-first SDK with optional UI widgets for integrating Crossmint wallets, authentication, and checkout into your Flutter application.
Installation
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:
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 step above if you only use the provider.
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:
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:
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