The Solana SDK for Dart & Flutter
Build on Solana in typed Dart.
A full port of @solana/kit: addresses, codecs, RPC, subscriptions, transactions, signers, and program clients, written with records, sealed classes, and extension types.
dart pub add solana_kit
-
Instruction
getAddMemoInstruction(…) -
Message
createTransactionMessage(…) -
Signed
signTransactionWithSigners(…) -
Confirmed
sendAndConfirmTransaction(…)
-
68packages on pub.dev
-
v8.6.0@solana/kit parity target
-
Dart 3records, patterns, sealed classes
-
MITopen-source licence
Examples
Real code, straight from the repo
Every snippet below is cut from a runnable file in examples/, which CI analyses on every change, so it cannot drift from the API.
Fetch on-chain state
Create an RPC client, then ask for an account. The response carries its context slot and a value that is null when the account does not exist.
- Every RPC method returns a pending request you send when ready
- Typed configs such as GetAccountInfoConfig instead of raw maps
- Missing accounts are a null value, not an exception
final rpc = createSolanaRpc(url: 'https://api.devnet.solana.com');
const systemProgram = Address('11111111111111111111111111111111');
final typedInfo = await rpc
.getAccountInfoValue(
systemProgram,
GetAccountInfoConfig(encoding: AccountEncoding.base64),
)
.send();
final account = typedInfo.value;
if (account != null) {
print('\nSystem program exists.');
print(' owner : ${account['owner']}');
print(' lamports : ${account['lamports']}');
print(' executable: ${account['executable']}');
}
Build, sign, send, confirm
Transaction messages are immutable values you build up step by step, then compile, sign with any signer, and confirm.
- A fluent, immutable message builder
- Signers are interfaces, so key pairs and wallets are interchangeable
- Confirmation strategies are built in
Read: First transaction →examples/23_transaction_send_and_confirm.dart
final payer = generateKeyPairSigner();
final blockhashResult = await rpc.getLatestBlockhashValue().send();
final blockhash = blockhashResult.value;
const memoProgram = Address('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
final memoData = Uint8List.fromList('Hello devnet!'.codeUnits);
final message = createTransactionMessage(version: TransactionVersion.v0)
.withFeePayer(payer.address)
.withBlockhashLifetime(
BlockhashLifetimeConstraint(
blockhash: blockhash.blockhash.value,
lastValidBlockHeight: blockhash.lastValidBlockHeight,
),
)
.appendInstruction(
Instruction(
programAddress: memoProgram,
accounts: [
AccountMeta(
address: payer.address,
role: AccountRole.readonlySigner,
),
],
data: memoData,
),
);
final transaction = compileTransaction(message);
final signed = await signTransactionWithSigners([payer], transaction);
final sig = await sendAndConfirmTransaction(rpc: rpc, transaction: signed);
Subscribe over WebSockets
Subscriptions are Dart streams. Pass a cancellation token to tear the socket subscription down cleanly.
- Channel pooling and autopinging out of the box
- Cancellation tokens instead of dangling listeners
- Every notification method from the Solana RPC
Read: Build a realtime observer →examples/16_rpc_subscriptions.dart
final rpcSubscriptions = createSolanaRpcSubscriptions(
'wss://api.devnet.solana.com',
);
final controller = CancellationTokenSource();
final pending = rpcSubscriptions.slotNotifications();
final stream = await pending.subscribe(
RpcSubscribeOptions(abortSignal: controller.token),
);
Describe byte layouts with codecs
Compose small codecs into a struct that encodes and decodes an account layout. Field order is byte order.
- Numbers, strings, arrays, options, enums, and structs
- Fixed and variable sizes that you can see in the types
- The same codec model as @solana/kit, in idiomatic Dart
final mintCodec = combineCodec(
fixEncoderSize(getBase58Encoder(), 32),
fixDecoderSize(getBase58Decoder(), 32),
);
final tokenAccountCodec = getStructCodec([
('mint', mintCodec), // 32 bytes
('owner', mintCodec), // 32 bytes
('amount', getU64Codec()), // 8 bytes (BigInt)
('isInitialized', getBooleanCodec()), // 1 byte
]);
final encoded = tokenAccountCodec.encode(account);
final decoded = tokenAccountCodec.decode(encoded);
Call programs through typed clients
Generated program clients build instructions and multi-step instruction plans, with every account named.
- System, Token, Token-2022, Stake, Memo, Metaplex, and more
- Instruction plans for flows that span several transactions
- Generate your own client from an IDL with the Codama renderer
Read: Build a program client →examples/28_program_clients.dart
final instruction = getAddMemoInstruction(
programAddress: memoProgramAddress,
memo: 'hello from solana_kit',
);
final delegate = getDelegateStakeInstructionPlan(
stake: account,
vote: secondAccount,
stakeAuthority: authority,
);
Derive program addresses
Program-derived addresses come back as a record of address and bump, ready to destructure.
- Address is an extension type: free at runtime, checked at compile time
- String and byte seeds
- Curve checks for keys and PDAs
Read: solana_kit_addresses →examples/04_program_derived_address.dart
final (vaultPda, vaultBump) = await getProgramDerivedAddress(
programAddress: systemProgram,
seeds: ['vault', 'user-42'],
);
final onCurve = isOnCurveAddress(vaultPda);
Why Solana Kit
Everything @solana/kit does, the Dart way
-
Typed end to end
Addresses, lamports, slots, signatures, and RPC responses are real Dart types, so mistakes surface in your editor, not on chain.
-
Modular by design
Import the umbrella solana_kit package, or depend on exactly the 68 focused packages you need.
-
Tracks upstream
Ported from @solana/kit and pinned to v8.6.0, with executable parity checks for the behaviour that matters most.
-
Flutter ready
Mobile Wallet Adapter for Android, Wallet Standard contracts, and a wallet UI kit for your Flutter screens.
-
Program clients
Clients for System, Token, Stake, Metaplex, and more, a runtime coder for Anchor IDLs, and a Codama renderer for your own.
-
Errors you can match
Every failure is a SolanaError with an upstream-compatible code and context, ready for an exhaustive switch.
Start here
Pick your path
New to Solana Kit?
Install the SDK, generate a signer, read an account, and send your first transaction.
Start the quick start →Shipping a Flutter app?
Connect mobile wallets, render wallet UI, and publish to the Solana dApp Store.
Connect a wallet →Coming from TypeScript?
See which @solana/kit release each package tracks and where the Dart API deliberately differs.
Check compatibility →Get started
Install the SDK and send a first transaction.
Core concepts
How the pieces of the SDK fit together.
Guides
End-to-end walkthroughs for real integrations.
Flutter & mobile
Wallets, UI kits, and app distribution.
Programs
Typed clients for on-chain programs.
Reference
Packages, versions, and upstream parity.
Contributing
Work on the SDK itself.
Package map
Small packages, one toolkit
Each layer is its own package with its own changelog. Here are the ones you will reach for first.