setEncryptionMode method Null safety

Future<void> setEncryptionMode(
  1. EncryptionMode encryptionMode

Sets the built-in encryption mode.


This method is deprecated. Use RtcChannel.enableEncryption instead.

The Agora SDK supports built-in encryption, which is set to aes-128-xts mode by default. Call this method to set the encryption mode to use other encryption modes. All users in the same channel must use the same encryption mode and password. Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.


  • Do not use this method for CDN streaming.
  • Before calling this method, ensure that you have called RtcChannel.setEncryptionSecret to enable encryption.

Parameter encryptionMode Sets the encryption mode. See EncryptionMode.


Future<void> setEncryptionMode(EncryptionMode encryptionMode) {
  return _invokeMethod('setEncryptionMode', {
    'encryptionMode': EncryptionModeConverter(encryptionMode).value(),