pullPast method

Future<void> pullPast(
  1. int count
)

Pulls past tiles up to count, appending to buffer.

Similar to pullFuture, but for backward direction; sets hasReachedEndOfPast on empty constant pulls.

Implementation

Future<void> pullPast(int count) async {
  if (_busy) return;
  if (hasReachedEndOfPast) return;
  _busy = true;
  try {
    List<T> m = await doPullPast(count, pastCursor);

    if (constantPast && m.isEmpty) {
      _reachedEnd = true;

      if (kDebugMode) {
        warn(
            "[CARPET] Reached end of past content, Ignoring subsequent pulls from past");
      }
    }

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