stopScreenCaptureService static method

Future<bool> stopScreenCaptureService()

Stop the screen capture foreground service.

Call this when screen sharing is stopped. On non-Android platforms, this is a no-op.

Returns true if the service stopped successfully.

Implementation

static Future<bool> stopScreenCaptureService() async {
  if (kIsWeb) {
    return true;
  }

  try {
    final result =
        await _channel.invokeMethod<bool>('stopScreenCaptureService');
    _isServiceRunning = !(result ?? true);
    return result ?? true;
  } on PlatformException catch (e) {
    debugPrint('Failed to stop screen capture service: ${e.message}');
    return false;
  } on MissingPluginException {
    debugPrint('QuickRTC platform plugin not available');
    return true;
  }
}