encode method
Encodes the base58 representation of this key using the version
prefix.
Implementation
String encode(int version) {
checkUint32(version, "version");
Uint8List data = Uint8List(encodedLength);
ByteData bd = data.buffer.asByteData();
bd.setUint32(0, version);
bd.setUint8(4, depth);
bd.setUint32(5, parentFingerprint);
bd.setUint32(9, index);
data.setRange(13, 45, _chaincode);
if (privateKey != null) {
bd.setUint8(45, 0);
data.setAll(46, privateKey!.data);
} else {
data.setAll(45, publicKey.data);
}
return base58Encode(data);
}