sendMessage method
Sends a message.
text is the message text.
Throws an exception if sending fails.
Implementation
Future<void> sendMessage(String text) async {
if (text.trim().isEmpty) return;
try {
await service.sendMessage(
chatId: chatId,
authorId: currentUserId,
text: text.trim(),
replyToMessageId: _replyingTo?.id,
);
// Reset reply after sending
_replyingTo = null;
notifyListeners();
} catch (e) {
_error = e.toString();
notifyListeners();
rethrow;
}
}