encryptAsync function Null safety

Future<Uint8List> encryptAsync(
  1. CryptoRSAPublicKey key,
  2. Uint8List plaintext
)

Implementation

Future<Uint8List> encryptAsync(CryptoRSAPublicKey key, Uint8List plaintext) {
  Map<String, String> q = {};
  q['plaintext'] = base64.encode(plaintext);
  q['key'] = key.encode();
  return compute(
          (Map<String, String> q) => encrypt(
              CryptoRSAPublicKey.decode(q['key']!),
              base64.decode(q['plaintext']!)),
          q)
      .then((ciphertext) => ciphertext);
}