addUCOTransfer method Null safety
- dynamic to,
- double amount
Add a UCO transfer to the transaction @param {String | Uint8List} to Address of the recipient (hexadecimal or binary buffer) @param {double} amount Amount of UCO to transfer
Implementation
TransactionBuilder addUCOTransfer(to, double amount) {
if (!(to is Uint8List) && !(to is String)) {
throw "'to' must be a string or Uint8List";
}
if (to is String) {
if (isHex(to)) {
to = hexToUint8List(to);
} else {
throw "'to' must be an hexadecimal string";
}
}
final UcoTransfer ucoTransfer = UcoTransfer();
ucoTransfer.to = to;
ucoTransfer.amount = amount;
data!.ledger!.uco!.transfers!.add(ucoTransfer);
return this;
}