pluralize 0.0.8 copy "pluralize: ^0.0.8" to clipboard
pluralize: ^0.0.8 copied to clipboard

A new Flutter package to check if a word is singular or plural, it can also convert words to plural or singular

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:

https://youtu.be/pVZCmgdxin8

https://youtu.be/Bgsn4zodmko

Features #

  • Pluralize and singularize any word.
  • Check if a word is singular or plural.
  • Works with irregular words.
  • Works with uncountable words. Pluralize demo

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

9
likes
160
points
1.2k
downloads

Publisher

verified publisherincaview.com

Weekly Downloads

A new Flutter package to check if a word is singular or plural, it can also convert words to plural or singular

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on pluralize