decrypt static method

String? decrypt({
  1. required String key,
  2. required String text,
})

Implementation

static String? decrypt({required String key, required String text}) {
  String result;
  if (key.length != 16) {
    return null;
  }
  try {
    final encrypter = Encrypter(AES(Key.fromUtf8(key), mode: AESMode.cbc));
    result = encrypter.decrypt(Encrypted.from64(text), iv: iv);
    return result;
  } catch (e) {
    // log(e.toString());
    return null;
  }
}