line property

String get line

One line for a reply: kind, question, choices with their ids, or the text it shows.

Implementation

String get line {
  final name = switch (kind) {
    SurfaceKind.permissionPrompt => 'permission prompt',
    SurfaceKind.alert => 'alert',
    SurfaceKind.picker => 'photo picker',
    SurfaceKind.sheet => 'native screen',
    SurfaceKind.otherApp => 'another app${owner == null ? '' : ' ($owner)'}',
    SurfaceKind.unknown => 'native surface',
  };
  final parts = [
    if (title != null) '"$title"',
    if (choices.isNotEmpty) 'choices: ${choices.map((c) => '${c.text} (${c.id})').join(', ')}',
    if (choices.isEmpty && texts.isNotEmpty) 'reads: ${texts.take(_maxTexts).map((t) => '"$t"').join(', ')}',
  ];
  return 'surface: $name${parts.isEmpty ? '' : ' · ${parts.join(' · ')}'}';
}