ur_registry_flutter 0.2.0 copy "ur_registry_flutter: ^0.2.0" to clipboard
ur_registry_flutter: ^0.2.0 copied to clipboard

An ffi bridge for ur_registry_rust and flutter.

ur_registry_flutter #

This is an FFI bridge for ur-registry-rust with flutter usage.

This plugin only support Android and iOS currently.

Getting Started #

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.

AnimatedQRCode #

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
)

AnimatedQRScanner #

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) {
  
}

Build #

See ur-registry-rust for more info.

0
likes
100
pub points
62%
popularity

Publisher

unverified uploader

An ffi bridge for ur_registry_rust and flutter.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

convert, ffi, flutter, flutter_bloc, qr_code_scanner, qr_flutter, uuid

More

Packages that depend on ur_registry_flutter