handleInput method
Handle input from the user during the interactive session Returns true if input was handled, false if session should exit
Implementation
@override
bool handleInput(String input) {
if (!_isActive) return false;
input = input.trim();
if (input.toLowerCase() == 'q' || input.toLowerCase() == 'quit') {
_outputStream.writeln(green.wrap("Exiting interactive mode"));
exit();
return false;
}
if (_waitingForAction) {
return _handleActionInput(input);
}
if (input.toLowerCase() == 'l' || input.toLowerCase() == 'list') {
_showNotificationList();
return true;
}
final index = int.tryParse(input);
if (index == null || index < 1 || index > _notifications.length) {
_outputStream.writeln(red.wrap("Invalid selection. Enter a number 1-${_notifications.length}, 'l' to relist, or 'q' to quit."));
return true;
}
final selectedNotification = _notifications[index - 1];
final notificationId = selectedNotification['id'];
_outputStream.writeln(green.wrap("Selected notification ID: $notificationId"));
_outputStream.writeln(cyan.wrap("Enter 'v' to view details or 'd' to delete:"));
_waitingForAction = true;
_selectedNotificationIndex = index - 1;
return true;
}