The Flutter SDK provides widget-based providers and scopes for integrating wallet functionality into your widget tree. These are optional — the SDK is headless-first and all features can be used directly via controllers .
CrossmintWalletProvider — All-in-one provider (recommended)
CrossmintClientScope — Low-level client scope
CrossmintAuthScope — Low-level auth scope
CrossmintWalletScope — Low-level wallet scope
CrossmintWalletProvider
All-in-one provider that initializes the client, auth, and wallet controller. Handles session restoration, OAuth callback routing, and OTP prompt display automatically. This is the recommended entry point for widget-based apps.
Props
config
CrossmintWalletProviderConfig
required
Configuration for the provider, containing client and wallet controller settings. clientConfig
CrossmintClientConfig
required
Client configuration including API key and app scheme. Your Crossmint client-side API key.
Deep link scheme for OAuth callbacks (e.g. "myapp").
Custom auth storage implementation. Defaults to flutter_secure_storage.
walletControllerConfig
CrossmintWalletControllerConfig
required
otpPromptBuilder
CrossmintOtpPromptBuilder
Builder for the OTP prompt dialog. Use crossmintDefaultOtpPromptBuilder from crossmint_flutter_ui.dart for the built-in dialog, or supply your own.
The widget subtree that can access the wallet context.
Usage
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 : 'myapp' ,
),
walletControllerConfig : CrossmintWalletControllerConfig (
createOnLogin : CrossmintCreateOnLoginConfig (
chain : 'base-sepolia' ,
recovery : const CrossmintEmailSignerConfig (),
),
showOtpSignerPrompt : true ,
),
otpPromptBuilder : crossmintDefaultOtpPromptBuilder,
),
child : const HomeScreen (),
),
);
}
}
CrossmintWalletControllerConfig
Configuration for the wallet controller, used by both CrossmintWalletProvider and the headless CrossmintClient.createWalletController().
createOnLogin
CrossmintCreateOnLoginConfig
Wallet configuration for automatic creation on user login. The blockchain to create the wallet on (e.g. "base-sepolia").
recovery
CrossmintSignerConfig
required
The recovery signer configuration (e.g. CrossmintEmailSignerConfig()). Used for wallet recovery and adding new signers.
signers
List<CrossmintSignerConfig>
Optional list of operational signers. Defaults to a device signer if omitted.
Optional list of wallet plugin identifiers.
When true (default), OTP signer prompts are shown during signing flows. When false, signing flows must be handled manually via the wallet controller’s OTP API.
callbacks
CrossmintWalletLifecycleCallbacks
Optional lifecycle callbacks invoked during wallet creation and transaction signing.
Storage implementation for device signer keys. Defaults to native Secure Enclave (iOS) / Android Keystore.
CrossmintClientScope
Low-level scope that provides a CrossmintClient instance to the widget subtree.
Usage
import 'package:crossmint_flutter/crossmint_flutter_ui.dart' ;
CrossmintClientScope (
config : CrossmintClientConfig (
apiKey : 'YOUR_CLIENT_API_KEY' ,
appScheme : 'myapp' ,
),
child : const MyApp (),
)
Access the client from descendant widgets:
final client = CrossmintClientScope . of (context);
CrossmintAuthScope
Provides the auth client to the widget subtree. Must be nested inside a CrossmintClientScope.
Usage
CrossmintClientScope (
config : CrossmintClientConfig (apiKey : 'YOUR_CLIENT_API_KEY' ),
child : CrossmintAuthScope (
child : const LoginScreen (),
),
)
CrossmintWalletScope
Provides the wallet controller to the widget subtree. Must be nested inside a CrossmintClientScope.
Usage
CrossmintClientScope (
config : CrossmintClientConfig (apiKey : 'YOUR_CLIENT_API_KEY' ),
child : CrossmintWalletScope (
config : CrossmintWalletControllerConfig (
createOnLogin : CrossmintCreateOnLoginConfig (
chain : 'base-sepolia' ,
recovery : const CrossmintEmailSignerConfig (),
),
),
child : const WalletScreen (),
),
)
CrossmintWalletGate
Status-based widget that renders different builders depending on the wallet state. Must be used within a CrossmintWalletProvider or CrossmintWalletScope.
All builders receive a CrossmintWalletContextData object, which provides access to the current state, auth client, wallet controller, and actions.
Props
readyBuilder
Widget Function(BuildContext, CrossmintWalletContextData)
required
Builder called when the wallet is loaded and ready. Access the wallet via data.state.currentWallet.
unauthenticatedBuilder
Widget Function(BuildContext, CrossmintWalletContextData)
Builder called when the user is not authenticated.
initializingBuilder
Widget Function(BuildContext, CrossmintWalletContextData)
Builder called while the SDK is initializing. Defaults to a CircularProgressIndicator.
errorBuilder
Widget Function(BuildContext, CrossmintWalletContextData)
Builder called when an error occurs.
Usage
CrossmintWalletGate (
readyBuilder : (context, data) {
// readyBuilder fires once authenticated — the wallet may
// still be loading. Guard on hasWallet before accessing it.
if ( ! data.state.hasWallet) {
return const Center (child : CircularProgressIndicator ());
}
return DashboardScreen (wallet : data.state.currentWallet ! );
},
unauthenticatedBuilder : (context, data) => const LoginScreen (),
initializingBuilder : (context, data) => const Center (
child : CircularProgressIndicator (),
),
)