decryptData method

String decryptData(
  1. String encryptedData
)

Decrypts the provided encryptedData using the AES encryption algorithm and the generated encryption key. Returns the decrypted data as a string.

Implementation

String decryptData(String encryptedData) {
  try {
    final algorithm = AES(_requiredKey!);
    final enc = Encrypter(algorithm);
    final decrypted = enc.decrypt64(encryptedData, iv: _iv);
    return decrypted;
  } catch (e) {
    print('Decryption error: $e');
    return encryptedData;
  }
}