fetchThreads method Null safety

Future<ThreadResult> fetchThreads(
  1. {Mailbox? mailbox,
  2. required DateTime since,
  3. ThreadPreference threadPreference = ThreadPreference.latest,
  4. FetchPreference fetchPreference = FetchPreference.envelope,
  5. int pageSize = 30}

Retrieves the threads starting at since.

Optionally specify the mailbox, in case not the currently selected mailbox should be used. Choose with threadPreference if only the latest (default) or all messages should be fetched. Choose what message data should be fetched using fetchPreference, which defaults to FetchPreference.envelope. Choose the number of downloaded messages with pageSize, which defaults to 30. Note that you can download further pages using fetchThreadsNextPage. Compare supportsThreading.


Future<ThreadResult> fetchThreads(
    {Mailbox? mailbox,
    required DateTime since,
    ThreadPreference threadPreference = ThreadPreference.latest,
    FetchPreference fetchPreference = FetchPreference.envelope,
    int pageSize = 30}) {
  mailbox ??= _selectedMailbox;
  if (mailbox == null) {
    throw StateError('no mailbox defined nor selected');
  return _incomingMailClient.fetchThreads(
      mailbox, since, threadPreference, fetchPreference, pageSize);