Skip to main content
Final Class Stateful orchestrator for Crossmint wallets in a Flutter app.
Holds the currently-loaded CrossmintWallet, exposes lifecycle operations (getWallet, createWallet, ensureLoaded, refresh, clear), surfaces OTP challenges via otp, and provides create*Wallet* convenience methods that wire a runtime wallet with a signer of your choosing (device, non-custodial, external, passkey). Obtain one from CrossmintClient.createWalletController and pair it with CrossmintWalletHost (headless) or CrossmintWalletProvider (opt-in Material UI) so the hidden signer bridge has a place to mount. Extends ChangeNotifier — listen to the controller for wallet-state changes. Mutations go through the controller’s public API; observation can additionally go through state for a narrower, read-only surface.

Constructors

CrossmintWalletController

Creates a wallet controller. Prefer CrossmintClient.createWalletController over calling this directly.

Properties

client

The underlying client — exposed for code that needs direct access to sub-clients (auth, orders, credentials, etc.).

config

The configuration this controller was built with.

otp

OTP controller for non-custodial email/phone signer challenges.

state

Read-only observation surface for the underlying wallet state. Advanced consumers can subscribe to wallet / status changes directly via this Listenable while still routing all mutations through the controller’s public API (getWallet, createWallet, refresh, clear, …).

currentWallet

The currently-loaded wallet, or null if none is loaded.

status

Current wallet lifecycle status.

onAuthRequired

The auth-required callback the controller wires into every signer it builds. Exposed so apps building signers manually can share the same OTP-handling path.

pendingOtpChallenge

Shortcut to CrossmintWalletOtpController.pendingChallenge.

otpChallengeListenable

Shortcut to CrossmintWalletOtpController.challengeListenable.

requireCurrentWallet

Returns the currently-loaded wallet or throws CrossmintWalletException when none is loaded.

Methods

getWallet

Looks up an existing wallet and stores the result in controller state. Returns null when no wallet matches. Listeners fire on state changes.

loadWallet

Deprecated: use getWallet instead.

createWallet

Creates a new wallet and stores it in controller state. Validates passkey signers up-front via crossmintValidatePasskeySigners and fires CrossmintWalletLifecycleCallbacks.onWalletCreationStart if set.

ensureLoaded

Ensures a wallet is loaded, creating one if configured to do so.

refresh

Re-fetches the currently-loaded wallet from the API. Returns null when nothing is loaded.

clear

Drops the loaded wallet and any pending OTP challenge. Call during sign-out.

sendOtp

Shortcut to CrossmintWalletOtpController.sendOtp.

verifyOtp

Shortcut to CrossmintWalletOtpController.verifyOtp.

rejectOtp

Shortcut to CrossmintWalletOtpController.reject.

createEvmWallet

Wraps the currently-loaded wallet as a runtime CrossmintEvmWallet. Throws CrossmintWalletException if no wallet is loaded.

createSolanaWallet

Wraps the currently-loaded wallet as a runtime CrossmintSolanaWallet. On Solana, device signer support depends on the wallet type and is validated server-side. A default device signer is not auto-injected for Solana; it is registered reactively and falls back to the recovery signer when the server rejects it.

createStellarWallet

Wraps the currently-loaded wallet as a runtime CrossmintStellarWallet.

createEvmWalletWithDeviceSigner

Builds a runtime EVM wallet backed by a hardware-backed device signer. Use for low-friction, day-to-day signing with keys in Secure Enclave / Android Keystore.

createEvmWalletWithNonCustodialSigner

Builds a runtime EVM wallet backed by a non-custodial email/phone signer. Requires CrossmintWalletHost (or CrossmintWalletProvider) mounted in the widget tree.

createSolanaWalletWithNonCustodialSigner

Builds a runtime Solana wallet backed by a non-custodial email/phone signer. Requires a mounted wallet host.

createStellarWalletWithNonCustodialSigner

Builds a runtime Stellar wallet backed by a non-custodial email/phone signer. Requires a mounted wallet host.

createStellarWalletWithDeviceSigner

Builds a runtime Stellar wallet backed by a hardware device signer.

createEvmWalletWithExternalWalletSigner

Builds a runtime EVM wallet backed by a user-owned external wallet (e.g. MetaMask). The caller supplies onSign to perform signatures.

createSolanaWalletWithExternalWalletSigner

Builds a runtime Solana wallet backed by a user-owned external wallet.

createStellarWalletWithExternalWalletSigner

Builds a runtime Stellar wallet backed by a user-owned external wallet.

createEvmWalletWithPasskeySigner

Builds a runtime EVM wallet backed by a passkey signer.

createSolanaWalletWithPasskeySigner

Builds a runtime Solana wallet backed by a passkey signer. See createEvmWalletWithPasskeySigner for passkey selection semantics.

createStellarWalletWithPasskeySigner

Builds a runtime Stellar wallet backed by a passkey signer. See createEvmWalletWithPasskeySigner for passkey selection semantics.

dispose