setSecret method Null safety
- dynamic secret
Add a secret to the transaction @param {String | Uint8List} secret Secret encrypted (hexadecimal or binary buffer)
Implementation
TransactionBuilder setSecret(secret) {
if (!(secret is Uint8List) && !(secret is String)) {
throw "'secret' must be a string or Uint8List";
}
if (secret is String) {
if (isHex(secret)) {
secret = hexToUint8List(secret);
} else {
secret = Uint8List.fromList(utf8.encode(secret));
}
}
data!.keys!.secret = secret;
return this;
}