This is an FFI bridge for ur-registry-rust
with flutter usage.
This plugin only support Android and iOS currently.
This package has two components, AnimatedQRCode
and AnimatedQRScanner
.
And other UR registry types, please refer to the code source to see how to use them.
This component is designed to show animated qr code.
When you want to use AnimatedQRCode to show your data, you shall assemble your data firstly.
For example:
final List<int> signData = [];
final String path = "M/44'/501'/1'/0'";
final String xfp = "12345678";
final Uint8List pubkey = base58.decode("any wallet address");
final SolSignRequest signRequest = SolSignRequest.factory(signData, path, xfp, pubkey, 'origin', isTransaction ? 1 : 2);
final urEncoder = signRequest.toUREncoder();
Then you can pass the assembled urEncoder to the component in your page:
AnimatedQRCode(
urEncoder: urEncoder
)
This component is designed to scan animated qr codes.
When you want to use this component, you should pass in expected UR type, a success callback and a failure callback to this component.
The supported types are listed at ur_decoder.dart
;
for example:
AnimatedQRScanner(
target: SupportedType.solSignRequest,
onSuccess: _cubit.onScanSuccess,
onFailed: _cubit.onScanFailed
),
the onSuccess
callback will return a NativeObject
instance then you can cast it to your expected type.
in this case:
void onScanSuccess(NativeObject object) {
final SolSignRequest solSignRequest = object as SolSignRequest;
//...
}
void onScanFailed(String reason) {
}
See ur-registry-rust for more info.