writeTextFileAsync function
Creates file
and writes contents
to it.
If dontLogContents
is true
, the contents of the file will never be
logged.
Implementation
Future<void> writeTextFileAsync(
String file,
String contents, {
bool dontLogContents = false,
Encoding encoding = utf8,
bool recursive = false,
}) async {
deleteIfLink(file);
final fileObject = File(file);
if (recursive) {
await fileObject.create(recursive: true);
}
await fileObject.writeAsString(contents, encoding: encoding);
}