unipayscan 0.1.0
unipayscan: ^0.1.0 copied to clipboard
Deterministic, local-first payment QR/address parsing - UPI, Pix, EMVCo, Bitcoin, Ethereum, and more, one normalized result. Dart FFI bindings over the same Rust core every SDK in this project uses.
unipayscan (Flutter) #
dart:ffi bindings over the same Rust core every SDK in this project uses (crates/core), via
the generic C ABI in crates/ffi - no JNI needed, Dart FFI calls C directly. No parsing logic is
reimplemented here.
Installing #
Not yet published to pub.dev. Once it is, this will work:
flutter pub add unipayscan
Until then, depend on it directly from this repository:
dependencies:
unipayscan:
git:
url: https://github.com/anshitraj/Universal-Payment-Scanner.git
path: bindings/flutter
import 'package:unipayscan/unipayscan.dart';
final result = UniversalPaymentQr.parse('upi://pay?pa=merchant%40bank&am=499.00&cu=INR');
print(result['scheme']); // upi
final scanner = createScanner(schemes: {'upi': true, 'bitcoin': false});
scanner.scan(payload);
Verified in this session #
flutter test (8/8 tests) against a real host build of crates/ffi, using
libraryPathOverride to point at it directly - see test/unipayscan_test.dart. That proves the
Dart↔Rust FFI contract (types, JSON shape, memory ownership) is correct end to end.
flutter pub publish --dry-run reports 0 warnings against the current package.
Not verified in this session #
- Android:
android/build.gradlebundles the.sofiles fromtarget/android-jniLibs/(build them with thecargo ndkcommand in the repository root README's Android section), andNativeBindingsopenslibuniversal_payment_qr_ffi.soby name onPlatform.isAndroid- that resolution logic was not exercised against a real device/emulator or a fullflutter build apkin this session. - iOS/macOS:
NativeBindingscallsDynamicLibrary.process(), which only works if the library is statically linked into the app binary - that linking (an Xcode build phase or CMake rule referencingcrates/ffi'sstaticliboutput) doesn't exist yet. Needs a Mac to build and verify; this repository was developed on Windows. - Linux/Windows desktop Flutter apps: no packaging exists yet either; use
libraryPathOverrideto point at your own build ofcrates/ffiin the meantime, the same way the test suite does.
Running the tests yourself #
cargo build --release -p universal-payment-qr-ffi # from the repository root
cd bindings/flutter
flutter pub get
flutter test
flutter pub publish --dry-run # re-check pub.dev readiness after any change