key method

Aes key(
  1. dynamic key
)

Sets the secret key on the object.

Implementation

Aes key(dynamic key) {
  if (key is SecureRandom) {
    _key = key.bytes;
  } else if (key is List<int>) {
    _key = Uint8List.fromList(key);
  } else if (key is Uint8List) {
    _key = key;
  } else if (key is String) {
    _key = base64.decode(key);
  } else {
    throw Exception('Unknown key type: [${key?.runtimeType.toString()}]');
  }

  return this;
}