text property

String get text

Implementation

String get text {
  final items = this;
  if (items.isEmpty) return '';
  if (items.length == 1) return items.first;

  final itemList = items.toList();
  final lastItem = itemList.removeLast();

  return '${itemList.join(', ')} and $lastItem';
}