format method Null safety

String format(
  1. Record record,
  2. {int? fullDataEndAddress}
)
override

Implementation

String format(Record record, {int? fullDataEndAddress}) {
  if (record.length != recordLength) {
    throw Exception('Record should be of length $recordLength');
  }

  final sb = StringBuffer();
  sb.write('0x' + Hex.hex32(record.startAddress));
  sb.write('\t');
  for (int? datum in record.data) {
    if (datum != null) {
      sb.write(Hex.hex8(datum));
    } else {
      sb.write('--');
    }
    sb.write(' ');
  }
  return sb.toString();
}