PluralityExtensions extension
Provides plurality-related extension methods on String.
// 'dogs'
'dog'.toPluralForm();
// 'dog'
'dogs'.toSingularForm();
// '2 dogs'
'dog'.toPluralFormForQuantity(2);
See also:
- on
Methods
-
toPluralForm(
{String? locale}) → String - Converts this String to plural form.
-
toPluralFormForQuantity(
{required num quantity, bool includeQuantity = true, String? locale}) → String -
Converts this string to the appropriate plural form to describe the specified
quantity
, including the quantity in the returned result ifincludeQuantity
istrue
. -
toSingularForm(
{String? locale}) → String - Converts this String to singular form.