loadMore method

Future<void> loadMore()

Loads an older page by widening the live watchMessages window.

Implementation

Future<void> loadMore() async {
  if (!_hasMore || _isLoading) return;
  if (_messageLimit >= _messageLimitMax) {
    _hasMore = false;
    notifyListeners();
    return;
  }
  final previousCount = _messages.length;
  _messageLimit = (_messageLimit + _messageLimitStep).clamp(0, _messageLimitMax);
  _listenMessages();
  // After re-subscribe, if count did not grow, stop offering more.
  // (Listener updates _hasMore when the next snapshot arrives.)
  if (previousCount == 0) return;
}