read static method

Future<String?> read({
  1. required Folder folder,
  2. required String fileName,
  3. String decrypter(
    1. String ciphertext
    )?,
})

Read the file.

folder is the folder to read the file from.

fileName is the name of the file.

decrypter is an additional function to decrypt the data.

Implementation

static Future<String?> read({
  required Folder folder,
  required String fileName,
  String Function(String ciphertext)? decrypter,
}) async {
  File file = await _initFile(
    folder: folder,
    fileName: fileName,
  );

  if (file.existsSync()) {
    return decrypt(file.readAsStringSync(), decrypter);
  }

  return null;
}