ValueRecipient.parse constructor

ValueRecipient.parse(
  1. XmlElement element
)

Factory method to parse an XmlElement and create a ValueRecipient object from it.

The element is an XML element containing the value recipient information.

Returns the parsed ValueRecipient object.

Implementation

factory ValueRecipient.parse(XmlElement element) {
  final splitStr = element.getAttribute('split');
  final feeStr = element.getAttribute('fee');
  return ValueRecipient(
    name: element.getAttribute('name'),
    customKey: element.getAttribute('customKey'),
    customValue: element.getAttribute('customValue'),
    type: element.getAttribute('type'),
    address: element.getAttribute('address'),
    split: splitStr == null ? null : int.tryParse(splitStr),
    fee: feeStr?.toLowerCase() == 'true',
  );
}