pluralize function

String pluralize(
  1. String word,
  2. int count, {
  3. String? plural,
})

Pluralizes a word, following english rules (1, many).

Pass a custom named plural for irregular plurals: pluralize('index', count, plural: 'indices') So it returns indices and not indexs.

Implementation

String pluralize(String word, int count, {String? plural}) =>
    count == 1 ? word : (plural ?? '${word}s');