encryptToBase64 method

String encryptToBase64({
  1. required String text,
  2. String? key,
  3. String? iv,
})

Implementation

String encryptToBase64({
  required String text,
  String? key,
  String? iv,
}) {
  iv ??= this.iv;
  key ??= this.key;
  final encrypter = Encrypter(AES(Key.fromUtf8(key)));

  return encrypter.encrypt(text, iv: IV.fromBase64(iv)).base64;
}