dispose method

  1. @override
void dispose()
override

Implementation

@override
void dispose() {
  if (_isDisposed) {
    RxLogger.warning('${runtimeType.toString()} already disposed');
    return;
  }
  _isDisposed = true;

  try {
    _subscriptionBag.dispose();

    for (var handler in _disposeHandlers) {
      try {
        handler.dispose();
      } catch (error, stackTrace) {
        RxLogger.logError(error, stackTrace);
      }
    }

    _disposeHandlers.clear();
  } catch (error, stackTrace) {
    RxLogger.logError(error, stackTrace);
  } finally {
    super.dispose();
  }
}