fromXdr method Null safety

TransactionPreconditions fromXdr(
  1. XdrPreconditions xdr
)

Implementation

static TransactionPreconditions fromXdr(XdrPreconditions xdr) {
  TransactionPreconditions result = TransactionPreconditions();
  if (xdr.discriminant.value == XdrPreconditionType.V2.value) {
    if (xdr.v2!.timeBounds != null) {
      result.timeBounds = TimeBounds.fromXdr(xdr.v2!.timeBounds!);
    }
    if (xdr.v2!.ledgerBounds != null) {
      result.ledgerBounds = LedgerBounds.fromXdr(xdr.v2!.ledgerBounds!);
    }
    if (xdr.v2!.sequenceNumber != null) {
      result.minSeqNumber = xdr.v2!.sequenceNumber!.uint64;
    }
    result.minSeqAge = xdr.v2!.minSeqAge.uint64;
    result.minSeqLedgerGap = xdr.v2!.minSeqLedgerGap.uint32;
    List<XdrSignerKey> keys = [];
    for (var i = 0; i < xdr.v2!.extraSigners.length; i++) {
      keys.add(xdr.v2!.extraSigners[i]);
    }
    result.extraSigners = keys;
  } else {
    if (xdr.timeBounds != null) {
      result.timeBounds = TimeBounds.fromXdr(xdr.timeBounds!);
    }
  }
  return result;
}