sendMessage method
void
sendMessage()
Implementation
void sendMessage() async {
// isSendButtonEnabled = false; // Listener on messageCtrl handles this
final text = messageCtrl.text;
if (text.isEmpty) return; // Prevent sending empty messages
messageCtrl.clear();
// notifyListeners(); // Listener on messageCtrl handles this
final lp = room.localParticipant;
if (lp == null) return;
final nowUtc = DateTime.now().toUtc();
final segment = sdk.TranscriptionSegment(
id: uuid.v4(), text: text, firstReceivedTime: nowUtc, lastReceivedTime: nowUtc, isFinal: true, language: 'en');
roomContext.insertTranscription(components.TranscriptionForParticipant(segment, lp));
await lp.sendText(text, options: sdk.SendTextOptions(topic: 'lk.chat'));
}