release method

Future<void> release()

Destroy and stop event to the client with related channels.

Implementation

Future<void> release() async {
  await _eventSubscription
      ?.cancel()
      .then((value) => _eventSubscription = null);
  await Future.forEach<AgoraRtmChannel>(
      _channels.values, (element) => element.release());
  await _callNative("release", null);
  _clients.removeWhere((int key, _) => key == _clientIndex);
}