text property

  1. @override
String? get text
override

Get the text content of the response

Implementation

@override
String? get text {
  final content = _rawResponse['content'] as List?;
  if (content == null || content.isEmpty) return null;

  final textBlocks = content
      .where((block) => block['type'] == 'text')
      .map((block) => block['text'] as String?)
      .where((text) => text != null)
      .cast<String>();

  return textBlocks.isEmpty ? null : textBlocks.join('\n');
}