Record.prefix constructor Null safety

Record.prefix(
  1. int startAddress,
  2. Iterable<int?> data,
  3. int size
)

Implementation

factory Record.prefix(int startAddress, Iterable<int?> data, int size) {
  if (data.length != size) {
    data = <int?>[...List<int?>.filled(size - data.length, null), ...data];

    startAddress -= data.length - size;
  }

  return Record(startAddress, data.toList());
}