saveFile function

Future<File> saveFile(
  1. File file,
  2. String data, [
  3. Encoding encoding = utf8
])

Saves a file from data string using encoding.

encoding If null uses UTF-8.

Implementation

Future<File> saveFile(File file, String data,
    [Encoding encoding = utf8]) async {
  return file.writeAsString(data, encoding: encoding, flush: true);
}