decryptFileString function

String decryptFileString({
  1. required File file,
  2. required String encryptionKey,
})

Decrypt and return the contents of the given file, using the given encryptionKey as a string.

Implementation

String decryptFileString({
  required final File file,
  required final String encryptionKey,
}) {
  final encrypter = Encrypter(AES(Key.fromBase64(encryptionKey)));
  final iv = IV.fromLength(16);
  final encrypted = Encrypted(file.readAsBytesSync());
  return encrypter.decrypt(encrypted, iv: iv);
}