Pluralize and singularize any word.
This package is an adaptation of this pluralize npm package for dart. https://www.npmjs.com/package/pluralize
Process of creating the package
If you are interested in creating flutter packages, I have documented the process of creating this package in this videos:
Features
- Pluralize and singularize any word.
- Check if a word is singular or plural.
- Works with irregular words.
- Works with uncountable words.
Getting Started
Add the dependency to your pubspec.yaml
file.
pluralize: ^0.0.8
Usage
We have singular and plural methods that convert text And isSingular and isPlural to check if a word is singular or plural.
final pluralize = Pluralize();
assert(pluralize.isPlural('cats'));
assert(!pluralize.isPlural('cat'));
assert(pluralize.isPlural('dogs'));
assert(!pluralize.isPlural('dog'));
assert(pluralize.isSingular('dog'));
assert(pluralize.plural('cat') == 'cats');
assert(pluralize.plural('dog') == 'dogs');
assert(pluralize.singular('bird') == 'bird');
Contributing
If you want to contribute to this project your PRs are welcome here:
https://github.com/ivofernandes/pluralize
The tests are not covering all the possible cases, so if you want to add more tests, please do so. https://github.com/ivofernandes/pluralize/blob/main/test/pluralize_test.dart
I'm also quite sure that is not supporting all the irregular and uncountable words. So free feel to help this package to improve.
License
MIT License