/// <summary>
        /// Releases all resources used by this object.
        /// </summary>
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            FlutnetRuntime.OnPlatformEvent -= FlutnetRuntimeOnPlatformEvent;

            _methodChannelIncoming.Dispose();
            _methodCallHandlerIncoming.Dispose();
            _methodChannelTest.Dispose();
            _methodCallHandlerTest.Dispose();
            _eventChannel.Dispose();
            _streamHandler.Dispose();

            if (Mode == FlutnetBridgeMode.WebSocket)
            {
                _context.StopService(new Android.Content.Intent(_context, typeof(FlutnetWebSocketService)));
            }

            _disposed = true;
        }