EthereumProvider class
Singleton EIP-1193 provider handling RPC, signing and transactions.
Supports three modes:
- External signer (
Web3Signer) – WalletConnect / Secure Enclave etc. - Local private key –
privateKeyhex string (backward compat) - Read-only – no signer, only
eth_call/eth_get*work; signing throws 4100.
Constructors
- EthereumProvider()
-
factory
Properties
- address → String?
-
Current signer address or null in read-only.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isReadOnly → bool
-
Whether provider is in read-only mode (no signer).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Disposes Web3 client and HTTP client.
-
getAddressFromPrivateKey(
String privateKey) → String? - Returns EIP-55 address or null if invalid – never throws
-
getProviderScript(
) → String - Generates JS provider script for injection.
-
handleRequest(
String method, List? params) → Future -
Handles JSON-RPC
methodwithparamsper EIP-1193. -
initialize(
{required NetworkConfig defaultNetwork, String? privateKey, Web3Signer? signer, required EIP6963ProviderInfo providerInfo, List< NetworkConfig> additionalNetworks = const [], WalletDialogTheme? theme, WalletDialogTheme? darkTheme, WalletDialogBuilders? dialogBuilders}) → Future<void> - Initializes provider.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setContext(
BuildContext context) → void - Sets BuildContext for dialogs.
-
setWebViewController(
InAppWebViewController controller) → void - Sets WebView controller for JS emits.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited