Cashu Card for Flutter
Use a Cashu Card 3.0 or 3.1 with a Flutter wallet on Android or iOS. This package connects Dart to the Rust reader using flutter_rust_bridge. The wallet supplies its NFC transport, payment journal and payout destination. The reader handles the card protocol and settlement with the mint.
Install
dependencies:
cashucard:
git:
url: https://github.com/cashucard/dart-sdk
ref: v0.4.0
Use Flutter with Dart 3.13.7 or newer in the 3.x series. Run flutter pub get. The Android and iOS builds use CargoKit and Rust and download the pinned public Rust core when the package first builds.
Use the reader
import 'package:cashucard/cashucard.dart';
Future<void> startReader() async {
await RustLib.init();
}
Open the reader with your durable journal, payout and platform callbacks. Keep one active reader per journal and keep its generation counter in a separate durable store. To accept a card, open a sale with a stable ID and price, supply the platform NFC callback, and show the holder the price, fees and change before they confirm. Run settlement after a take, at startup and when connectivity returns. Apply each merchant payout exactly once.
Amounts use Dart BigInt. The giveBackToCard and owedToCard APIs let the wallet return change to the original card. More protocol and integration documentation is on the Cashu Card developer site.
Test the binding
Build the host library with cargo build --locked --manifest-path rust/Cargo.toml, then run flutter test. You can point the test at an existing build using CASHUCARD_TEST_LIBRARY.
License
MIT. Developed by Cashu Card contributors including getfoxy and Island Bitcoin. The vendored build tool includes its license.