mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
add extension functionality
This commit is contained in:
parent
f4d61a9f58
commit
7b353be350
2 changed files with 6 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:dart_bs58/dart_bs58.dart';
|
||||
|
@ -6,6 +7,8 @@ import 'package:hex/hex.dart';
|
|||
import 'package:stackwallet/utilities/extensions/extensions.dart';
|
||||
|
||||
extension StringExtensions on String {
|
||||
Uint8List get toUint8ListFromUtf8 => Uint8List.fromList(utf8.encode(this));
|
||||
|
||||
Uint8List get toUint8ListFromHex =>
|
||||
Uint8List.fromList(HEX.decode(startsWith("0x") ? substring(2) : this));
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:dart_bs58/dart_bs58.dart';
|
||||
|
@ -5,6 +6,8 @@ import 'package:dart_bs58check/dart_bs58check.dart';
|
|||
import 'package:hex/hex.dart';
|
||||
|
||||
extension Uint8ListExtensions on Uint8List {
|
||||
String get toUtf8String => utf8.decode(this);
|
||||
|
||||
String get toHex {
|
||||
return HEX.encode(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue