readFloat method

double readFloat()

Reads a 32-bit IEEE 754 float from the current buffer position.

Uses big-endian byte order. Advances the buffer position by 4 bytes. Returns the float value as a double

Implementation

double readFloat() {
  // https://stackoverflow.com/questions/55355482/parsing-integer-bit-patterns-as-ieee-754-floats-in-dart
  // Use a single ByteData view instead of creating new instances
  int intValue = readInt();
  _sharedByteData.setInt32(0, intValue, Endian.big);
  return _sharedByteData.getFloat32(0, Endian.big);
}