watchOnSyncCompletion method

StreamSubscription<bool> watchOnSyncCompletion()

Implementation

StreamSubscription<bool> watchOnSyncCompletion() {
  _logger.d('[OfflineFirstRepository] watchOnSyncCompletion');

  if (_syncCompletedSubscription == null ||
      _syncCompletedSubscription!.isPaused) {
    _logger.d('[OfflineFirstRepository] Creating new subscription');
    _syncCompletedSubscription =
        _syncCompletedController.stream.listen((completed) {
      _logger.d('[OfflineFirstRepository] Sync completed: $completed');
    });
  } else {
    _logger.d('[OfflineFirstRepository] Returning existing subscription');
  }

  return _syncCompletedSubscription!;
}