operator [] method
Retrieves the message for the given messageIndex
.
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.
Compare isAvailable
Implementation
MimeMessage operator [](int messageIndex) {
final index = (messages.length - messageIndex - 1);
if (index < 0) {
throw RangeError(
'for messageIndex $messageIndex in a result with the length $length and currently loaded message count of ${messages.length}');
}
return messages[index];
}