text property
Get the text content of the response
Implementation
@override
String? get text {
final candidates = _rawResponse['candidates'] as List?;
if (candidates == null || candidates.isEmpty) return null;
final content = candidates.first['content'] as Map<String, dynamic>?;
if (content == null) return null;
final parts = content['parts'] as List?;
if (parts == null || parts.isEmpty) return null;
final textParts = parts
.where((part) => part['text'] != null)
.map((part) => part['text'] as String)
.toList();
return textParts.isEmpty ? null : textParts.join('\n');
}