handleExampleQuestionTapWithResponse method
Implementation
Future<void> handleExampleQuestionTapWithResponse(
final String question,
final Future<String> Function(String) onAiResponse,
) async {
final userMessage = _createMessage(
user: _user,
text: question,
);
_messages.insert(0, userMessage);
_showWelcomeMessage = false;
notifyListeners();
try {
final aiResponse = await onAiResponse(question);
_messages.insert(
0,
_createMessage(
user: _aiUser,
text: aiResponse,
),
);
notifyListeners();
} on Exception {
// Handle error
}
}