getPluralCategory<T> method

T getPluralCategory<T>({
  1. required T other,
  2. T? zero,
  3. T? one,
  4. T? two,
  5. T? few,
  6. T? many,
  7. String? locale,
  8. int? precision,
  9. String? meaning,
  10. bool useExplicitNumberCases = true,
})

Determines the plural category of this number based on the current locale.

This uses the Intl.pluralLogic function to categorize the number into one of the following: 'zero', 'one', 'two', 'few', 'many', or 'other'.

Arguments:

  • other: A default value to return if none of the specific plural forms match.
  • zero, one, two, few, many: Values to return for specific plural forms (optional).
  • locale, precision, meaning: Optional parameters to customize the pluralization rules (see Intl.pluralLogic documentation).
  • useExplicitNumberCases: If true, number cases (e.g., "1") are passed to Intl.pluralLogic. If false, only the number's value is passed.

Implementation

T getPluralCategory<T>({
  required T other,
  T? zero,
  T? one,
  T? two,
  T? few,
  T? many,
  String? locale,
  int? precision,
  String? meaning,
  bool useExplicitNumberCases = true,
}) =>
    Intl.pluralLogic(
      this,
      zero: zero,
      one: one,
      two: two,
      few: few,
      many: many,
      other: other,
      locale: locale,
      precision: precision,
      meaning: meaning,
      useExplicitNumberCases: useExplicitNumberCases,
    );