textContent property

String? get textContent

Get text content from message

Implementation

String? get textContent {
  if (content is String) {
    return content as String;
  } else if (content is List) {
    final textItem = (content as List).firstWhere(
          (item) => item is Map && item['type'] == 'text',
      orElse: () => null,
    );
    return textItem?['text'] as String?;
  }
  return null;
}