pluralize method
Returns a string combining this number with the correct singular or plural form of a word.
- If the number is 1, returns "1
- Otherwise, returns "
Example:
1.pluralize("apple"); // "1 apple"
3.pluralize("apple"); // "3 apples"
2.pluralize("child", plural: "children"); // "2 children"
Implementation
String pluralize(String singular, {String? plural}) => this == 1 ? "$this $singular" : "$this ${plural ?? '${singular}s'}";