setEncryptionSecret method Null safety

Future<void> setEncryptionSecret(
  1. String secret

Enables built-in encryption with an encryption password before joining a channel.


This method is deprecated. Use RtcChannel.enableEncryption instead.

All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user leaves the channel. If the encryption password is not specified or set to empty, the encryption functionality is disabled.


  • For optimal transmission, ensure that the encrypted data size does not exceed the original data size + 16 bytes. 16 bytes is the maximum padding size for AES encryption.
  • Do not use this method for CDN live streaming.

Parameter secret The encryption password.


Future<void> setEncryptionSecret(String secret) {
  return _invokeMethod('setEncryptionSecret', {
    'secret': secret,