destroy method Null safety

Future<void> destroy()

Destroys the RtcEngine instance and releases all resources used by the Agora SDK.

This method is useful for apps that occasionally make voice or video calls, to free up resources for other operations when not making calls.

Note

  • Call this method in the subthread.
  • Once the app calls RtcEngine.destroy to destroy the created RtcEngine instance, you cannot use any method or callback in the SDK.

Implementation

@override
Future<void> destroy() {
  RtcChannel.destroyAll();
  _instance?._handler = null;
  _instance = null;
  return _invokeMethod('destroy');
}