dispose method

Future<void> dispose()

Dispose of all resources.

Call this when the processor is no longer needed.

Implementation

Future<void> dispose() async {
  // Dispose platform segmenter
  if (_isInitialized) {
    await _platformSegmenter.dispose();
  }

  // Dispose legacy segmenter if present
  await legacySegmenter?.dispose();

  _isInitialized = false;
  _currentBackground = null;
  _cachedBackgroundImage?.dispose();
  _cachedBackgroundImage = null;
  _cachedBackgroundId = null;
  debugPrint('VirtualBackgroundProcessor: Disposed');
}