base58DecimalTo58 method
Converts a decimal number to Base58 using the specified alphabet.
Implementation
String base58DecimalTo58(String number) {
var decimalValue = BigInt.parse(number);
_DivResult resultDiv;
String remainder;
String result = '';
while (decimalValue.bitLength >= 2) {
resultDiv = _divideBigInt(decimalValue, BigInt.from(58));
decimalValue = resultDiv.coefficient;
remainder = resultDiv.remainder.toInt().toString();
result = NosoConst.b58Alphabet[int.parse(remainder)] + result;
}
if (decimalValue >= BigInt.from(58)) {
resultDiv = _divideBigInt(decimalValue, BigInt.from(58));
decimalValue = resultDiv.coefficient;
remainder = resultDiv.remainder.toInt().toString();
result = NosoConst.b58Alphabet[int.parse(remainder)] + result;
}
if (decimalValue > BigInt.zero) {
result = NosoConst.b58Alphabet[decimalValue.toInt()] + result;
}
return result;
}