setEncryptInfo method
Set encrypt info
key is the encryption key, with a length limit of 36 characters. Excess characters will be truncated.
Return value:
0: Call succeeded;<0: Call failed, see ReturnStatus for details.
Note: This method must be called before joining a room and can be called repeatedly. The last called parameters will take effect.
Implementation
Future<int?> setEncryptInfo({
required EncryptType aesType,
required String key,
}) {
if (Platform.isAndroid) {
return ($instance as $a.RTCEngine).setEncryptInfo(aesType.$value, key)
as Future<int?>;
} else {
return ($instance as $i.ByteRTCEngine).setEncryptInfo(
// Which should be t_xxx.code_to_ios
// But it's not exist, besides, the values of ByteRTCEncryptType and EncryptType are same.
// It's can be written as following.
($i.ByteRTCEncryptType.values.firstWhere(
(e) => e.$value == aesType.$value,
)),
key,
) as Future<int?>;
}
}