encryptText static method

String encryptText(
  1. String plainText,
  2. String secretKey
)

Implementation

static String encryptText(String plainText, String secretKey) {
  final key = encrypt.Key.fromUtf8(secretKey.padRight(32).substring(0, 32));
  final iv = encrypt.IV.fromLength(16);
  final encrypter = encrypt.Encrypter(encrypt.AES(key));
  return encrypter.encrypt(plainText, iv: iv).base64;
}