-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
i am not getting response from for image only getting instance of image part
Future _processImage() async {
if (_selectedImage == null) {
setState(() {
_response = 'No image selected';
});
return;
}
try {
final bytes = await _selectedImage!.readAsBytes();
Gemini.instance.textAndImage(
text: 'Analyze this image and describe its content.',
images: [bytes],
).then((response) {
final parts = response?.content?.parts;
final lastText = parts ?? 'No text content found';
setState(() {
_response = lastText.toString();
});
}).catchError((error) {
setState(() {
_response = 'Error: $error';
});
});
} catch (e) {
setState(() {
_response = 'Error: $e';
});
}
}
i tried using that final lastText = parts ?? 'No text content found';.......parts.text but also there is error saying in text ........now only i am getting response as instance of textPart.....how to solve this problem
ArpitAswal
Metadata
Metadata
Assignees
Labels
No labels