addRecipient method
Add recipient to the transaction (with a named action)
to
: Recipient address (hexadecimal)action
: The named actionargs
: The arguments list for the named action (can only contain JSON valid data)
Implementation
Transaction addRecipient(
String to, {
String? action,
List<Object>? args,
}) {
if (!isHex(to)) {
throw const FormatException("'to' must be an hexadecimal string");
}
final newRecipient = data!.recipients.toList()
..add(Recipient(address: to, action: action, args: args));
return copyWith.data!(
recipients: newRecipient,
);
}