writeLines function

Future<File> writeLines(
  1. File file,
  2. List<String> lines, {
  3. Encoding encoding = utf8,
  4. bool? useCrLf,
})

Write lines content. Does not fail Uses CR/LF if useCrLf is true or if null and on windows

Implementation

Future<File> writeLines(File file, List<String> lines,
    {Encoding encoding = utf8, bool? useCrLf}) {
  if (lines.isEmpty) {
    return writeString(file, '', encoding: encoding);
  }
  var lf = (useCrLf ?? platformIsIoWindows) ? '\r\n' : '\n';
  return writeString(file, '${lines.join(lf)}$lf', encoding: encoding);
}