checkEncode static method

String checkEncode(
  1. List<int> dataBytes, [
  2. Base58Alphabets base58alphabets = Base58Alphabets.bitcoin
])

Encodes the provided List

This method appends a checksum to the data and then encodes the result into a Base58 encoded string.

Parameters:

  • dataBytes: The List
  • base58alphabets: Optional Base58Alphabets enum to choose the alphabet (default is Base58Alphabets.bitcoin).

Returns: A Base58 encoded string of the input dataBytes with a checksum.

Implementation

static String checkEncode(List<int> dataBytes,
    [Base58Alphabets base58alphabets = Base58Alphabets.bitcoin]) {
  dataBytes = dataBytes.asImmutableBytes;
  final checksum = Base58Utils.computeChecksum(dataBytes);
  final dataWithChecksum = List<int>.from([...dataBytes, ...checksum]);
  return encode(dataWithChecksum, base58alphabets);
}