reset method

Future<void> reset()

Resets the stream.

If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point.

Example

final reader = BufferedReader(FileReader('data.txt'));
if (reader.markSupported()) {
  reader.mark(1024);
  
  // Read and analyze some data
  final sample = await reader.readLine();
  
  if (needsReprocessing(sample)) {
    // Reset to marked position and reprocess
    await reader.reset();
    reprocessData(reader);
  }
}

Throws IOException if the stream has not been marked, or if the mark has been invalidated, or if the stream does not support reset, or if some other I/O error occurs.

Implementation

Future<void> reset() async {
  throw IOException('Mark/reset not supported');
}