onConnectionEstablished method
Is called after the initial connection has been established
Implementation
@override
FutureOr<void> onConnectionEstablished(
ConnectionInfo connectionInfo,
String serverGreeting,
) async {
_isInIdleMode = false;
_serverInfo = ImapServerInfo(connectionInfo);
final startIndex = serverGreeting.indexOf('[CAPABILITY ');
if (startIndex != -1) {
CapabilityParser.parseCapabilities(
serverGreeting, startIndex + '[CAPABILITY '.length, _serverInfo);
}
if (_queue.isNotEmpty) {
// this can happen when a connection was re-established,
// e.g. when trying to complete an IDLE connection
for (final task in _queue) {
try {
task.completer.completeError('reconnect');
} catch (e, s) {
print('unable to completeError for task $task $e $s');
}
}
_queue.clear();
}
}