The Complete Dart/Flutter SDK
Type-safe, performant, and production-ready SDK for building decentralized applications on Polkadot and Substrate-based chains. One codebase for mobile, web, and desktop.
import 'package:polkadart/polkadart.dart';
void main() async {
final uri = Uri.parse('wss://rpc.polkadot.io');
final provider = Provider.fromUri(uri);
final stateApi = StateApi(provider);
final runtimeVersion = await stateApi.getRuntimeVersion();
print(runtimeVersion.toJson());
}
Polkadart is a comprehensive Dart/Flutter SDK for Polkadot, providing everything you need to build robust blockchain applications with type safety and excellent developer experience.
Built by developers for developers, with intuitive APIs, excellent documentation, and comprehensive examples.
Auto-generated types from chain metadata ensure compile-time safety and eliminate runtime errors.
Write once, deploy everywhere. Native performance on iOS, Android, Web, macOS, Windows, and Linux.
Native Dart compilation and optimized SCALE codec deliver exceptional performance on all platforms.
Full support for ink! smart contracts with type-safe contract calls and event handling.
Actively developed with comprehensive test coverage, regular updates, and responsive community support.
Never Ship Runtime Errors Again
Polkadart generates strongly-typed APIs from chain metadata, ensuring your code is always in sync with the blockchain runtime. Catch errors at compile-time, not in production.
Every pallet, extrinsic, and storage item is type-safe. IDE auto-completion guides you through the entire API, making blockchain development as easy as traditional app development.
import 'package:demo/generated/polkadot/polkadot.dart'; import 'package:polkadart/polkadart.dart' show Provider; Future<void> main(List<String> arguments) async { final provider = Provider.fromUri(Uri.parse('wss://rpc.polkadot.io')); final polkadot = Polkadot(provider); final runtime = await polkadot.rpc.state.getRuntimeVersion(); print(runtime.toJson()); }
import 'package:polkadart_keyring/polkadart_keyring.dart'; Future<void> main(List<String> arguments) async { final keyring = Keyring(); final keyPair = await keyring.fromUri('//Alice'); print('Alice address: ${keyPair.address}'); }
Built with security best practices, including secure key management, proper signature verification, and protection against common blockchain vulnerabilities.
dart pub add polkadart polkadart_cli
polkadart: output_dir: lib/generated chains: polkadot: wss://rpc.polkadot.io
dart run polkadart_cli:generate -v
import 'package:polkadart/polkadart.dart'; import 'package:ss58/ss58.dart'; import './generated/polkadot/polkadot.dart'; import './generated/polkadot/types/frame_system/account_info.dart'; Future<void> main(List<String> arguments) async { final address = '1zugcag7cJVBtVRnFxv5Qftn7xKAnR6YJ9x4x3XLgGgmNnS'; final provider = Provider.fromUri(Uri.parse('wss://rpc.polkadot.io')); final api = Polkadot(provider); Address wallet = Address.decode(address); AccountInfo accountInfo = await api.query.system.account(wallet.pubkey); print(""" Free balance: ${accountInfo.data.free} Reserved balance: ${accountInfo.data.reserved} Nonce: ${accountInfo.nonce} """); }
Connect to Polkadot, Kusama, or any Substrate-based parachain. Auto-generate types specific to each chain's runtime for perfect compatibility.
import 'package:polkadart/provider.dart'; import './generated/assethub/assethub.dart'; import './generated/people/people.dart'; import './generated/polkadot/polkadot.dart'; Future<void> main(List<String> arguments) async { final polkadot = Polkadot(Provider.fromUri(Uri.parse('wss://rpc.polkadot.io'))); final people = People( Provider.fromUri(Uri.parse('wss://polkadot-people-rpc.polkadot.io'))); final assetHub = Assethub( Provider.fromUri(Uri.parse('wss://polkadot-asset-hub-rpc.polkadot.io'))); print('${await polkadot.query.session.validators()}'); print('${await people.query.identity.registrars()}'); print('${await assetHub.query.assets.nextAssetId()}'); }
Deploy, call, and listen to events from ink! smart contracts with full type safety and automatic ABI parsing.
import 'dart:typed_data'; import 'package:polkadart/polkadart.dart'; import 'generated_flipper.dart'; Future<void> main(List<String> arguments) async { final contract = Address.decode('5DXR2MxThkyZvG3s4ubu9yRdNiifchZ9eNV8i6ErGx6u1sea') final provider = Provider.fromUri(Uri.parse('ws://127.0.0.1')); final contract = Contract( provider: provider, address: contract.pubkey, ); // Call the get method print('Get value: ${await contract.get()}'); }
Create responsive applications that adapt seamlessly across mobile, tablet, and desktop. With Flutter's powerful UI framework and Polkadart's blockchain capabilities, deploy everywhere your users are.
import 'package:flutter/material.dart';
import 'package:polkadart_keyring/polkadart_keyring.dart';
class PolkadotApp extends StatefulWidget {
const PolkadotApp({super.key});
@override
State<PolkadotApp> createState() => _PolkadotAppState();
}
class _PolkadotAppState extends State<PolkadotApp> {
final keyring = Keyring();
List<Account> accounts = [];
generateNewAccount() async {
final derivationPath =
'//Alice${accounts.isNotEmpty ? '//${accounts.length}' : ''}';
final wallet = await keyring.fromUri(derivationPath, addToPairs: true);
final account = Account(wallet.address, derivationPath);
setState(() {
accounts.add(account);
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: MaterialColor(0xFFFF2670, <int, Color>{
50: polkadotPink,
100: polkadotPink,
200: polkadotPink,
300: polkadotPink,
400: polkadotPink,
500: polkadotPink,
600: polkadotPink,
700: polkadotPink,
800: polkadotPink,
900: polkadotPink,
}),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: polkadotPink,
textStyle: TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
),
),
home: Scaffold(
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 20, bottom: 3),
child: Text('Generate wallets by clicking on the button'),
),
Divider(),
Expanded(
child: ListView.builder(
itemCount: accounts.length,
itemBuilder: (BuildContext context, int index) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
minTileHeight: 10,
enabled: true,
title: Text(
accounts[index].encodedAddress,
style: const TextStyle(fontSize: 13),
),
subtitle: Text(
accounts[index].derivationPath,
style: TextStyle(fontSize: 10),
),
),
const Divider(),
],
);
},
),
),
Padding(
padding: const EdgeInsets.only(bottom: 12.0),
child: ElevatedButton(
onPressed: () async => await generateNewAccount(),
child: const Text('Generate a new account'),
),
),
],
),
),
);
}
}
class Account {
final String encodedAddress;
final String derivationPath;
Account(this.encodedAddress, this.derivationPath);
}
Color polkadotPink = const Color(0xFFFF2670);
void main() {
runApp(const PolkadotApp());
}
Polkadart is open source and shaped by a passionate global community of blockchain developers
Join our growing community of contributors building the future of blockchain development with Dart.
Join thousands of developers using Polkadart to build the next generation of decentralized applications
Read the documentation • Explore tutorials • Join our community • Contribute on GitHub