listMailboxes method
Lists all mailboxes/folders of the incoming mail server.
Optionally specify the order of the mailboxes, matching ones will be
served in the given order.
Implementation
Future<List<Mailbox>> listMailboxes({List<MailboxFlag>? order}) async {
var boxes = await _incomingLock.synchronized(
() => _incomingMailClient.listMailboxes(),
);
_mailboxes = boxes;
if (order != null) {
boxes = sortMailboxes(order, boxes);
}
if (boxes.isNotEmpty) {
final separator = boxes.first.pathSeparator;
if (separator != _account.incoming.pathSeparator) {
_account = _account.copyWith(
incoming: _account.incoming.copyWith(pathSeparator: separator),
);
unawaited(_onConfigChanged?.call(_account));
}
}
return boxes;
}