shutdown method

  1. @override
Future<void> shutdown()
override

Shutdown all services

Implementation

@override
Future<void> shutdown() async {
  try {
    // Stop all services
    if (_isBackgroundServiceRunning) {
      await stopBackgroundService();
    }

    // Cancel all notifications
    await cancelAllNotifications();

    // Hide tray icon if shown
    await hideTrayIcon();

    // Call native shutdown
    await methodChannel.invokeMethod<void>('shutdown');

    // Close event stream
    await _eventStreamController.close();
  } on PlatformException catch (e) {
    throw MCPPlatformException('Failed to shutdown', e.code, e.details);
  }
}