onConnectionError method
Is called when the connection encountered an error
Implementation
@override
void onConnectionError(dynamic error) {
logApp('onConnectionError: $error');
_isInIdleMode = false;
_selectedMailbox = null;
_failPendingIdleContinuation('connection error: $error');
// Previously only the event below was fired, so a command that was
// awaiting a response when the socket died never completed: with no
// responseTimeout set, `await sendCommand(...)` hung for the lifetime of
// the process, and even with one it waited out the full timeout for an
// error that had already arrived. The event cannot complete the caller's
// future on its own.
_completePendingTasksWithError('connection lost: $error');
fireEvent(ImapConnectionLostEvent(this));
}