stringToAddress function

Uint8List stringToAddress(
  1. String encoded
)

Implementation

Uint8List stringToAddress(String encoded) {
  if (_constants['sizes']!['symbolAddressEncoded'] == encoded.length) {
    var bytes = base32.decode(encoded + 'A');
    return Uint8List.fromList(
        bytes.sublist(0, _constants['sizes']!['symbolAddressDecoded']));
  }
  if (_constants['sizes']!['nemAddressEncoded'] == encoded.length) {
    return utf8ToBytes(encoded);
  }
  throw Exception('$encoded does not represent a valid encoded address');
}