Line data Source code
1 : import 'dart:math';
2 :
3 : extension SatoshiUtils on num {
4 0 : BigInt get toSatoshi {
5 0 : return BigInt.from(this * 100000000);
6 : }
7 :
8 10 : BigInt get toBI {
9 10 : return BigInt.from(this);
10 : }
11 :
12 0 : bool isUint(int bit) {
13 0 : return (this >= 0 && this <= pow(2, bit) - 1);
14 : }
15 : }
16 :
17 : extension SatoshiUtilsNullable on num? {
18 0 : BigInt? get toBI {
19 : if (this == null) {
20 : return null;
21 : }
22 0 : return BigInt.from(this!);
23 : }
24 : }
|