append method

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

Treat the contents of 'this' String as the name of a file and appends line 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. /// e.g.

'.bashrc'.append('export FRED=ONE');

See write and truncate Use withOpenFile for better performance.

Implementation

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