Skip to content
pubscout

web3dart

3.0.3, released 5 months ago by pwa.ir

A Dart library to connect to Ethereum clients and interact with smart contracts.

WASM-ready
$ flutter pub add web3dart
Source repository

What it does

Allows Flutter and Dart apps to connect to Ethereum and Celo nodes, send signed transactions, manage credentials, and interact with smart contracts. It also includes code generation based on smart contract ABIs.

AI-written summary of version 3.0.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to build a decentralized application (dApp) in Dart or Flutter.
  • You want to sign transactions and interact with smart contract ABIs.
  • You need Celo or Ethereum network integration.

Skip it when

  • You are building a traditional centralized backend application without blockchain integration.
  • You only require a simple wallet UI without direct node interactions.

Strengths

  • Supports Celo fee currencies and Ethereum transactions.
  • Provides smart contract ABI code generation using build_runner.
  • Supports raw private keys, version 3 wallet files, and browser providers.

Weaknesses

  • Relies on an external RPC client or node to send transactions.
  • Not all advanced or rare Solidity types may be fully encoded.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
12

Connects to an RPC endpoint (like Infura or Geth). For smart contract code generation, add web3dart_builders and build_runner to dev_dependencies.

import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart';

var apiUrl = "http://localhost:7545";
var httpClient = Client();
var ethClient = Web3Client(apiUrl, httpClient);

var credentials = EthPrivateKey.fromHex("0x...");
var address = credentials.address;

EtherAmount balance = await ethClient.getBalance(address);
print(balance.getValueInUnit(EtherUnit.ether));

Alternatives

Packages that do the same job and could replace web3dart.

  • on_chain

    Streamlines multi-chain blockchain operations for Ethereum, Tron, Solana, Cardano, Aptos, and Sui.

Works with

Packages commonly used together with web3dart: ones it builds on, ones built on it, and its own family.