fetchMessageSequence method

Future<List<MimeMessage>> fetchMessageSequence(
  1. MessageSequence sequence, {
  2. Mailbox? mailbox,
  3. FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
  4. bool markAsSeen = false,
})

Loads the specified sequence of messages.

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.

Compare fetchMessagesNextPage

Implementation

Future<List<MimeMessage>> fetchMessageSequence(
  MessageSequence sequence, {
  Mailbox? mailbox,
  FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
  bool markAsSeen = false,
}) async {
  await _selectMailboxIfNeeded(mailbox);

  return _incomingLock.synchronized(
    () => _incomingMailClient.fetchMessageSequence(
      sequence,
      fetchPreference: fetchPreference,
      markAsSeen: markAsSeen,
    ),
  );
}