onServerResponse method
Processes server responses
Implementation
void onServerResponse(List<String> responseTexts) {
if (isLogEnabled) {
for (final responseText in responseTexts) {
log(responseText, isClient: false);
}
}
final command = _currentCommand;
if (command == null) {
print('ignoring response starting with [${responseTexts.first}] '
'with ${responseTexts.length} lines.');
}
if (command != null) {
var parser = command.parser;
parser ??= _standardParser;
final response = parser.parse(responseTexts);
final commandText = command.nextCommand(response);
if (commandText != null) {
writeText(commandText);
} else if (command.isCommandDone(response)) {
if (response.isFailedStatus) {
command.completer.completeError(PopException(this, response));
} else {
command.completer.complete(response.result);
}
//_log("Done with command ${_currentCommand.command}");
_currentCommand = null;
}
}
}