read method

Future read()

Reads the next record into memory. You need to use this directly when reading only a subset of the fields using {@link #readField(int)}.

Implementation

Future read() async {
  var foundRecord = false;
  while (!foundRecord) {
    await bufferCheck();

    // read the deleted flag
    final deleted = buffer!.getByteChar(); //   (    char) buffer.get();
    row!.deleted = deleted == '*';

    // bytes = await fileReader.get(header.getRecordLength() - 1);
    buffer!.limit = buffer!.position + header!.getRecordLength() - 1;
    bytes = await buffer!.get(
        header!.getRecordLength() - 1); // SK: There is a side-effect here!!!
    buffer!.limit = buffer!.capacity;

    foundRecord = true;
  }

  cnt++;
}