destroy method
Destroy and stop event to the client with related channels.
Implementation
Future<void> destroy() async {
if (_closed) return null;
await _clientSubscription.cancel();
_closed = true;
for (String channelId in _channels.keys) {
await releaseChannel(channelId);
}
final res = await _callNative("destroy", null);
if (res["errorCode"] != 0)
throw AgoraRtmClientException(
"destroy failed ${res['errorCode']}", res["errorCode"]);
_clients.removeWhere((int? clientIndex, AgoraRtmClient client) =>
[_clientIndex].contains(clientIndex));
}