fetchMessages method
Future<List<MimeMessage> >
fetchMessages({
- Mailbox? mailbox,
- int count = 20,
- int page = 1,
- FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
Loads the specified page of messages starting at the latest message
and going down count messages.
Specify page number - by default this is 1, so the first
page is downloaded.
Optionally specify the mailbox in case none has been selected before
or if another mailbox/folder should be queried.
Optionally specify the fetchPreference to define the preferred
downloaded scope, defaults to FetchPreference.fullWhenWithinSize.
By default messages that are within the size bounds as defined in the
downloadSizeLimit in the MailClients constructor are downloaded fully.
Note that the fetchPreference cannot be realized on some backends such
as POP3 mail servers.
Compare fetchMessagesNextPage
Implementation
Future<List<MimeMessage>> fetchMessages({
Mailbox? mailbox,
int count = 20,
int page = 1,
FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
}) async {
final usedMailbox = await _selectMailboxIfNeeded(mailbox);
final sequence =
MessageSequence.fromPage(page, count, usedMailbox.messagesExists);
return _incomingLock.synchronized(
() => _incomingMailClient.fetchMessageSequence(
sequence,
fetchPreference: fetchPreference,
),
);
}