readInt method Null safety

int readInt(
  1. int byteLength,
  2. [Endian? endian]
)

Implementation

int readInt(int byteLength, [Endian? endian]) {
  switch (byteLength) {
    case 1:
      return readInt8();
    case 2:
      return readInt16(endian);
    case 4:
      return readInt32(endian);
    case 8:
      return readInt64(endian);
    default:
      throw ArgumentError(
          'byteLength ($byteLength) must be one of [1, 2, 4, 8].');
  }
}