userText property

String? get userText

The text of the user's latest message, including an app wake, or null when the run has none or its content is not text.

Implementation

String? get userText => switch (_messages
    .where((message) => message[AgUiFields.role] == AgUiMessageRoles.user)
    .lastOrNull) {
  {AgUiFields.content: final String text} => text,
  _ => null,
};