npuSentenceList function

String npuSentenceList(
  1. Iterable<String> items
)

items joined for a sentence: A, A and B, A, B and C.

Implementation

String npuSentenceList(Iterable<String> items) {
  final list = items.toList();
  if (list.length < 2) return list.join();
  return '${list.sublist(0, list.length - 1).join(', ')} and ${list.last}';
}