writeString function
Write a string content. Does not fail
Implementation
Future<File> writeString(File file, String content,
{Encoding encoding = utf8}) async {
try {
await file.writeAsString(content, flush: true, encoding: encoding);
} catch (_) {
await file.create(recursive: true);
await file.writeAsString(content, flush: true, encoding: encoding);
}
return file;
}