write method

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

Truncates and Writes line to the file terminated by newline. 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./// e.g.

'/tmp/log'.write('Start of Log')

See truncate, append. Use withOpenFile for better performance.

Implementation

void write(String line, {String? newline}) {
  newline ??= Platform().eol;
  withOpenFile(this, (file) {
    file.write(line, newline: newline);
  });
}