Skip to main content

Overview

Turnkey’s Flutter SDK provides a straightforward way to create and manage embedded wallets in your Flutter application. You can create wallets, derive accounts, import wallets, and keep local UI state in sync with provider data. Before starting, review the concepts of Wallets and Wallet Accounts.

Creating an embedded wallet

After the user authenticates (i.e., a session exists on TurnkeyProvider), you can create an embedded wallet and specify which accounts to create within it.
lib/widgets/create_wallet_button.dart

Listing and refreshing wallets

TurnkeyProvider.wallets contains all embedded wallets for the current sub-organization. It updates automatically when wallets change.
lib/widgets/wallet_list.dart
To refresh explicitly:
lib/widgets/refresh_wallets_button.dart

Creating wallet accounts (after wallet creation)

To add accounts to an existing wallet, use the createWalletAccounts method from the underlying client.
lib/widgets/add_account_button.dart

Importing wallets

You can import a wallet from a mnemonic using the importWallet method and optionally specify accounts to pre-create.
lib/widgets/import_wallet_button.dart

Exporting wallets

You can export a wallet’s mnemonic using the exportWallet method. This method will automatically decrypt the mnemonic for you.
lib/widgets/export_wallet_button.dart

Next steps

Continue to Signing to learn how to sign messages and transactions with your embedded wallets.