chatWithImageSync method
Send a multimodal chat message (text + image) - SYNC version
Implementation
Future<String> chatWithImageSync(
String text,
Uint8List imageBytes, {
String? conversationId,
}) async {
_assertInitialized();
final convId = conversationId ?? _currentConversationId;
if (convId == null) {
throw StateError('No conversation. Call createConversation() first.');
}
final request = ChatWithImageRequest()
..conversationId = convId
..text = text
..image = imageBytes;
final response = await _client!.chatWithImageSync(request);
if (response.hasError() && response.error.isNotEmpty) {
throw Exception('Chat error: ${response.error}');
}
return response.text;
}