write method

void write(
  1. String line, {
  2. String? newline,
})

Truncates the file to zero bytes and then writes the given text to the file. If newline is null or isn't passed then the platform end of line characters are appended as defined by Platform().eol. Pass null or an '' to newline to not add a line terminator.

Implementation

void write(String line, {String? newline}) {
  final finalline = line + (newline ?? Platform().eol);
  _raf
    ..truncateSync(0)
    ..setPositionSync(0)
    ..flushSync()
    ..writeStringSync(finalline);
}