Arbitrum One
Prêt à utiliser cela en production ?
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Arbitrum One
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Web3Dart is the primary library for reaching Arbitrum One from Dart and Flutter, letting you ship one codebase across iOS, Android, web, and desktop. Since Arbitrum One is an EVM-equivalent Nitro rollup, Web3Dart's standard JSON-RPC calls work against https://arbitrum.therpc.io/YOUR_API_KEY with no chain-specific tweaks. Add it with flutter pub add web3dart (or dart pub add web3dart for a pure Dart project). For production apps, store private keys in flutter_secure_storage, which is backed by the iOS Keychain and Android Keystore — never hardcode a key in source.
Web3Dart runs in both Flutter and pure Dart projects, so a command-line Arbitrum One indexer and a mobile wallet can share the same client code. Add it with flutter pub add web3dart. In production, keep signing keys in flutter_secure_storage rather than in code or plain preferences — a leaked key on an L2 like Arbitrum One drains real ETH just as fast as on mainnet.
Construct a Web3Client with the Arbitrum One HTTP endpoint and an http.Client() instance you keep alive for the app's lifetime. For production transactions, set explicit gas limits rather than relying solely on auto-estimation: Arbitrum One meters gas differently from L1 — its fee blends L2 execution with the cost of posting calldata to Ethereum — so an under-estimate can leave a transaction stuck. Reading the current gas price and bounding the limit yourself gives more predictable behavior.
For a reactive balance display, hold the EtherAmount in a StatefulWidget and call setState when a fresh value arrives from Arbitrum One. Because Flutter can rebuild a widget many times per second, don't trigger an RPC call inside build() — cache the last result and refresh it on an explicit action or a timed interval. Debouncing keeps you well within rate limits even though Arbitrum One's sub-second confirmations make near-real-time updates tempting.
To interact with a deployed Arbitrum One contract, build a DeployedContract from its ABI JSON string and its address — for example an Aave lending pool or a Camelot router. Use client.call() for view functions, which read the latest sequencer state for free, and client.sendTransaction() for state-changing calls, which submit an L2 transaction paid in ETH. Look up the contract address and verified ABI on https://arbiscan.io before wiring it in.
Wrap the raw exceptions Web3Dart throws — RPC failures, reverted Arbitrum One transactions, malformed addresses — in a domain-specific EthereumException so your UI layer catches one predictable type instead of leaking transport details to the screen. An EtherAmount extension that formats values to a fixed number of decimals keeps balance strings tidy, since ETH amounts on Arbitrum One carry the same 18 decimals as on L1.