encrypt method

String encrypt({
  1. required String data,
  2. String? newKey,
  3. String? iv,
})

Implementation

String encrypt({
  required String data,
  String? newKey,
  String? iv,
}) {
  iv ??= this.iv;
  newKey ??= key;

  final encrypter = Encrypter(
    AES(
      Key.fromUtf8(newKey),
      mode: AESMode.ctr,
    ),
  );

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