Tac
Dart / Flutter
Web3Dart is the primary library for reaching TAC from Dart and Flutter, letting you ship one codebase to iOS, Android, web, and desktop that talks to the same EVM chain (ID 239). Add it with flutter pub add web3dart in a Flutter project, or dart pub add web3dart for pure Dart. For any production app that signs TAC transactions, store private keys in flutter_secure_storage (backed by the iOS Keychain and Android Keystore) — never hardcode a key in source or ship it in your bundle.
Web3Dart works in both Flutter apps and standalone Dart programs, so the same TAC integration code serves a mobile wallet and a backend script alike. Add it with flutter pub add web3dart. In production, keep signing keys in flutter_secure_storage rather than in code or shared preferences — a leaked key on chain 239 means a drained account.
Web3Dart Library
Create a Web3Client by passing the TAC HTTP endpoint https://tac.therpc.io/YOUR_API_KEY together with a Client() from the http package — Web3Dart uses that for every JSON-RPC round-trip. In production transactions, set an explicit gas limit rather than relying solely on auto-estimation: estimation can fail or return a misleading value for contract-heavy calls, and a hard limit keeps a TAC transfer from stalling at submission time.
- GitHub: https://github.com/simolus3/web3dart
- Pub.dev: https://pub.dev/packages/web3dart
- Key features: cross-platform Flutter mobile dApps, contract interaction on TAC, transaction signing, HD wallet support (BIP-39/44), ENS resolution, ERC-20 and ERC-721 helpers, and gas estimation
Flutter Integration Examples
To show a live TAC balance in the UI, use a StatefulWidget and call setState once the balance comes back so the widget repaints with fresh data. Be careful not to fire an RPC call on every build — Flutter rebuilds widgets often, and an unguarded fetch will hammer your TAC endpoint. Trigger the call from an explicit action (a refresh button or initState), and cache or debounce results so chain 239 is queried only when the data actually needs refreshing.
Smart Contract Integration
To interact with a contract on TAC, build a DeployedContract from the ABI JSON string (wrapped in ContractAbi.fromJson) and the contract's on-chain address. Read-only functions go through client.call(), which queries the node without spending gas, while state-changing functions are submitted with client.sendTransaction() using signed credentials and confirmed once the block reaches finality on chain 239.
Error Handling and Utilities
Wrapping raw Web3Dart exceptions in a domain-specific EthereumException keeps your TAC error handling clean: callers catch one well-named type instead of a grab-bag of low-level transport and RPC errors. Pairing that with an EtherAmount extension gives you formatted, human-readable balance strings (for example, trimming a TAC amount to four decimals) without scattering conversion logic across your widgets.