Designing Cross-Platform Bitcoin SDKs with Flutter
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Shared and native layers
A Flutter package can share HTTP transport, response decoding and payment state across iOS and Android. Platform adapters handle secure storage, lifecycle notifications and device-specific authentication. Do not duplicate Bitcoin transaction construction in Dart: the engine executes the documented wallet operations. A commerce application should expose only its own backend payment API to the Flutter client.
Conceptual Dart interface
abstract interface class PaymentClient {
Future<InvoiceView> createInvoice(String orderId);
Future<InvoiceView> refreshInvoice(String invoiceId);
}InvoiceView is a proposed application model with network, address, expected satoshis and payment state. Define integer range constraints across targets, particularly when compiling to JavaScript. Serialize large integer values as decimal strings in an application contract if necessary; translate them to the engine's documented numeric representation only after validation. Do not silently round values.
State management
Keep payment state independent of widgets. A QR widget displays an address and amount but cannot verify payment. When the app resumes, retrieve authoritative state from the backend. Avoid polling loops tied to widget rebuilds; deduplicate refreshes and apply bounded backoff. An expired local countdown is not evidence that no payment arrived. The backend must reconcile late or partial payments under an explicit policy.
Acceptance plan
Use shared JSON fixtures to compare Dart decoding with Go and Kotlin implementations. Test widget rebuilds, deep-link inputs, network changes, and application restarts. Verify platform storage adapters independently and run testnet payment scenarios on Android and iOS when their toolchains are available. Flutter Web needs a distinct browser trust model and must not embed privileged wallet credentials. This design does not establish a published Flutter package.
Primary reference
https://thamer.org/api
Related reading
https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-authentication-credential-management
https://thamer.org/docs/wab-sdk-idempotency-retry-strategies
https://thamer.org/docs/wab-sdk-payment-reconciliation
https://thamer.org/docs/wab-sdk-mobile-bitcoin-architecture
https://thamer.org/docs/wab-sdk-swift-bitcoin-payments
https://thamer.org/docs/wab-sdk-kotlin-bitcoin-applications
https://thamer.org/docs/wab-sdk-mobile-secure-backend
https://thamer.org/docs/wab-sdk-desktop-applications
