onServerResponse method
void
onServerResponse(
- List<String?> responseTexts
)
Implementation
void onServerResponse(List<String?> responseTexts) {
if (isLogEnabled) {
for (var responseText in responseTexts) {
log(responseText, isClient: false);
}
}
var 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;
var response = parser.parse(responseTexts);
var 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;
}
}
}