removeMessageSequence method
Removes the specified removeSequence
from this result and returns all messages that have been loaded.
Note that the removeSequence
must be based on the same type of IDs (UID or sequence-ID) as this result.
Implementation
List<MimeMessage> removeMessageSequence(MessageSequence removeSequence) {
assert(removeSequence.isUidSequence == pagedSequence.isUidSequence,
'Not the same sequence ID types');
final isUid = pagedSequence.isUidSequence;
final ids = removeSequence.toList();
final result = <MimeMessage>[];
for (final id in ids) {
pagedSequence.remove(id);
final match = messages.firstWhereOrNull(
(msg) => isUid ? msg.uid == id : msg.sequenceId == id);
if (match != null) {
result.add(match);
messages.remove(match);
}
}
return result;
}