close method

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

Clean up any resources used by this integration This method MUST be implemented to prevent memory leaks and restore original system state

Implementation

@override
Future<void> close() async {
  ObslyLogger.warn(
      '🗑️ HTTPIntegration.close() CALLED - This will disable HTTP interception!');
  ObslyLogger.warn('🗑️ Stack trace: ${StackTrace.current}');

  if (!_isActive) {
    ObslyLogger.warn('🗑️ HTTPIntegration already inactive, skipping close');
    return;
  }

  await DefensiveExecution.safeAsync(() async {
    if (kIsWeb) {
      await _closeWebInterception();
    } else {
      await _closeNativeInterception();
    }
  }, operationName: 'HTTP_integration_cleanup');

  _hub = null;
  _isActive = false;

  ObslyLogger.warn(
      '🗑️ HTTPIntegration completely closed - HTTP interception DISABLED');
}