fetchMessagesNextPage method
Future<List<MimeMessage> >
fetchMessagesNextPage(
- PagedMessageSequence pagedSequence, {
- Mailbox? mailbox,
- FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
- bool markAsSeen = false,
Loads the next page of messages in the given pagedSequence
.
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
.
Set markAsSeen
to true
to automatically add the \Seen
flag in case it is not there yet when downloading the fetchPreference.full
.
Note that the preference cannot be realized on some backends such as POP3 mail servers.
Implementation
Future<List<MimeMessage>> fetchMessagesNextPage(
PagedMessageSequence pagedSequence,
{Mailbox? mailbox,
FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
bool markAsSeen = false}) {
if (pagedSequence.hasNext) {
final sequence = pagedSequence.next();
return fetchMessageSequence(sequence,
fetchPreference: fetchPreference, markAsSeen: markAsSeen);
} else {
return Future.value([]);
}
}