decryptToString method

String decryptToString(
  1. String base64
)

Decrypts a base64 string back to a plain string.

Implementation

String decryptToString(String base64) {
  try {
    final encrypter = Encrypter(AES(key, mode: AESMode.cbc));
    return encrypter.decrypt64(base64, iv: iv);
  } catch (e) {
    throw Exception('String decryption failed: $e');
  }
}