readFloat method
Reads and returns a 4-byte float, using the current endian setting.
Throws EOFException if EOF is reached before the needed bytes are read.
Implementation
Future<double> readFloat() async {
await _ensureNext();
if (_curr!.length - _pos < 4) {
// If we're on a buffer boundary
// Keep it simple
return (await readByteDataImmutable(4)).getFloat32(0, endian);
} else {
final result = _curr!.buffer
.asByteData()
.getFloat32(_pos + _curr!.offsetInBytes, endian);
_pos += 4;
return result;
}
}