initialize method
Implementation
Future<void> initialize({
required String domain,
required String chatbotId,
}) async {
_setLoading(false);
await _sseSubscription?.cancel();
_sseSubscription = null;
_messages.clear();
_currentThreadId = null;
try {
await _plugin.initialize(domain: domain, chatbotId: chatbotId);
notifyListeners();
} catch (e) {
_addMessage(ChatMessage(
message: 'Error initializing chat: $e',
isUser: false,
type: 'error',
timestamp: DateTime.now()));
rethrow;
}
}