getFloatAt method

double getFloatAt(
  1. int offset,
  2. int bytes,
  3. StructEndian endian
)

Read float with specified endianness

  • offset: The offset to read from
  • bytes: The number of bytes to read
  • endian: The endianness to use Returns the float value read

Implementation

double getFloatAt(int offset, int bytes, StructEndian endian) {
  switch (bytes) {
    case 4:
      return getFloat32(offset, endian.toEndian());
    case 8:
      return getFloat64(offset, endian.toEndian());
    default:
      throw ArgumentError('Unsupported float size: $bytes bytes');
  }
}