fetchMessagesNextPage method Null safety

Future<List<MimeMessage>> fetchMessagesNextPage(
  1. PagedMessageSequence pagedSequence,
  2. {Mailbox? mailbox,
  3. FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
  4. 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.


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([]);