writeFile function
Writes the given content
to the file located at filePath
. Set append
to true
to append the content
to the file instead of overwriting it.
Implementation
Future<void> writeFile(
String filePath,
String content, {
bool append = false,
}) async {
final localSystemFilePath = toLocalSystemPathFormat(filePath);
final file = File(localSystemFilePath);
await file.parent.create(recursive: true);
await file.writeAsString(
content,
mode: append ? FileMode.append : FileMode.write,
);
}