add method
Implementation
void add(String command) {
// Don't add empty commands or duplicates of the last command
if (command.trim().isEmpty ||
(_history.isNotEmpty && _history.last == command)) {
return;
}
_history.add(command);
_currentIndex = _history.length;
}