pullFuture method

Future<void> pullFuture(
  1. int count
)

Pulls future tiles up to count, inserting at buffer start.

Respects busy state and end flags; sets hasReachedStartOfFuture on empty constant pulls. Throws CarpetException on errors, logging failures.

Implementation

Future<void> pullFuture(int count) async {
  if (_busy) return;
  if (hasReachedStartOfFuture) return;
  _busy = true;
  try {
    List<T> m = await onPullFuture(count, futureCursor);

    if (constantFuture && m.isEmpty) {
      _reachedStart = true;

      if (kDebugMode) {
        warn(
            "[CARPET] Reached start of future posts, Ignoring subsequent pulls from future");
      }
    }

    buffer.insertAll(0, m);
  } catch (e, es) {
    error("[CARPET] Failed to pull future: $e $es");
    throw CarpetException("[CARPET] Failed to pull future.");
  } finally {
    _busy = false;
  }
}