Skip to content
pubscout

webthree

2.7.6, released 2 years ago by devopsdao.com

A Web3 library for Dart to interact with Ethereum nodes via HTTP or WebSocket.

WASM-ready
$ flutter pub add webthree
Source repository

What it does

It allows Dart and Flutter developers to connect to local or remote Ethereum nodes, call contract functions, listen for contract events, manage credentials, and send signed transactions. It also includes support for custom credentials providers like WalletConnect and Metamask, alongside ABI-based code generation.

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

Use it when

  • You need to interact with Ethereum or EVM-compatible blockchains in a Dart/Flutter application.
  • You want to generate Dart bindings from smart contract ABIs using build_runner.
  • You require custom credential providers like MetaMask or WalletConnect.

Skip it when

  • You need support for non-Ethereum blockchains that this library does not cover.
  • You prefer a strictly lightweight library without external build dependencies.

Strengths

  • Supports connecting to Ethereum nodes via HTTP and WebSocket.
  • Built-in smart contract ABI code generator for type-safe interactions.
  • Supports WalletConnect and Metamask integrations.

Weaknesses

  • Some advanced solidity types might have limited support.
  • Requires build_runner configuration for code generation features.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
18

Requires adding contract ABI JSON files and running build_runner for code generation if using smart contract bindings.

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

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

var credentials = EthPrivateKey.fromHex("0x...");
var address = await credentials.address;
EtherAmount balance = ethClient.getBalance(address);

Alternatives

Packages that do the same job and could replace webthree.

  • web3dart

    WebThree is a fork of web3dart; you may choose the original package depending on your stability or maintenance preferences.

  • blockchain_utils

    Provides a comprehensive set of cryptographic and serialization utilities for multi-chain blockchain development.

Works with

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