encrypt static method
Implementation
static String encrypt({
required String key,
required String text,
}) {
if (iv != null) {
String result;
if (key.length < 16) {
return "";
}
try {
final encrypter =
Encrypter(AES(Key.fromBase64(key), mode: AESMode.cbc));
final encrypted = encrypter.encrypt(text, iv: iv);
result = encrypted.base64;
return result;
} on Exception catch (e) {
log(e.toString());
return "";
}
} else {
return "";
}
}