write static method

Future<void> write({
  1. required String content,
  2. required Folder folder,
  3. required String fileName,
  4. String encrypter(
    1. String plaintext
    )?,
})

Write the file.

content is the data to write to the file.

folder is the folder to write the file to.

fileName is the name of the file.

encrypter is an additional function to encrypt the data.

Implementation

static Future<void> write({
  required String content,
  required Folder folder,
  required String fileName,
  String Function(String plaintext)? encrypter,
}) async {
  try {
    (await _initFile(
      folder: folder,
      fileName: fileName,
    ))
        .writeAsStringSync(encrypt(content, encrypter));
  } catch (_) {
    // Do nothing
  }
}