isAvailable method

bool isAvailable(
  1. int messageIndex
)

Checks if the message for the given messageIndex is already loaded.

Note that the messageIndex is expected to be based on full messageSequence, where index 0 is newest message and size-1 is the oldest message.

Implementation

bool isAvailable(int messageIndex) {
  final index = messages.length - messageIndex - 1;

  return index >= 0 && messageIndex >= 0;
}