idleDone method
Stops the IDLE mode.
For example after receiving information about a new message to download the message. Requires a mailbox to be selected and the mail service to support IDLE.
Compare idleStart
Implementation
Future idleDone() async {
if (!isConnected || !isLoggedIn) {
throw ImapException(this, 'idleDone(): not connected or logged in!');
}
if (!_isInIdleMode) {
print('$logName: warning: ignore idleDone(): not in IDLE mode');
return;
}
_isInIdleMode = false;
// as this is a potential breaking point, give it a timeout:
await writeText('DONE');
final completer = _idleCommandTask?.completer;
if (isLogEnabled && completer == null) {
logApp(
'There is no current idleCommandTask or '
'completer future $_idleCommandTask',
);
}
if (completer != null) {
completer.timeout(
defaultResponseTimeout ?? const Duration(seconds: 4),
this,
);
await completer.future;
} else {
await Future.delayed(const Duration(milliseconds: 200));
}
_idleCommandTask = null;
}