id_gen 0.7.8 copy "id_gen: ^0.7.8" to clipboard
id_gen: ^0.7.8 copied to clipboard

A standardized and well-tested set of IDs generators: globally unique, readable, time-dependency, transitive, incremental, decremental IDs.

ID Generators #

SDK version Supported platforms Supported SDKs

Cover - ID Generators

GitHub License Pub Package Code Size Publisher

Build Status Pull Requests Issues Pub Score

The standardized, easy-to-use, and well-tested set for generating identifiers: globally unique, readable, time-dependency, transitive, incremental, decremental IDs. Feel free to use it in your awesome project.

CodeFactor

Share some ❤️ and star repo to support the ID Generators.

If you write an article about IdGen or any of these packages, let me know and I'll post the URL of the article in the README 🤝

🚀 Usage #

Generate 4 UUIDs #

About UUID and online generator: https://uuidgenerator.net

print([for (var i = 0; i < 4; ++i) genUuid]);
[4c48329b-2c1b-4534-b649-1a462626bcd4, a1afafe2-d57a-46ae-9f27-7e42dc936475,
283ae055-cf4e-4d6d-b505-e2a7d60806d2, 843832d1-d0f0-48e7-8a61-3aa151c2103b]

Generate HumanID from Language #

Supported languages:

  • Belarusian
  • English
  • Ukrainian
const gen = HumanIdGen(options: HumanIdGenOptions(lowerCase: true));
final hid = gen.get('Тема статті чи назва курсу');
print(hid);
tema-stati-chy-nazva-kursu

Generate Transit Integer ID #

print([for (var i = 0; i < 4; ++i) genTransitId]);
[1, 2, 3, 4]

Generate Time Integer ID #

// milliseconds
print(genTimeId);
// microseconds
print(genTimeIdMicro);
1705954581187
1705954581188687

Note that second ID does not fit into 53 bits (the size of a IEEE double). A JavaScript number is not able to hold this value.

Add HID and UID to Any Class #

class Quant with HasStringIdMix {
  Quant({String? hid, String? uid}) {
    this.hid = hid;
    this.uid = uid;
  }
}

print(Quant().id);
print(Quant(hid: 'aerwyna').id);
92e6ee3e-537a-4dd3-b4e9-06b8fd366469
aerwyna

✨ What's New #

Look at changelog.

👋 Welcome #

If you encounter any problems, feel free to open an issue. If you feel the package is missing a feature, please raise a ticket on Github and I'll look into it. Requests and suggestions are warmly welcome. Danke!

Contributions are what make the open-source community such a great place to learn, create, take a new skills, and be inspired.

If this is your first contribution, I'll leave you with some of the best links I've found: they will help you get started or/and become even more efficient.

The package IdGen is open-source, stable and well-tested. Development happens on GitHub. Feel free to report issues or create a pull-request there.

General questions are best asked on StackOverflow.

And here is a curated list of how you can help:

  • Documenting the undocumented. Whenever you come across a class, property, or method within our codebase that you're familiar with and notice it lacks documentation, kindly spare a couple of minutes to jot down some helpful notes for your fellow developers.
  • Refining the code. While I'm aware it's primarily my responsibility to refactor the code, I wholeheartedly welcome any contributions you're willing to make in this area. Your insights and improvements are appreciated!
  • Constructive code reviews. Should you discover a more efficient approach to achieve something, I'm all ears. Your suggestions for enhancement are invaluable.
  • Sharing your examples. If you've experimented with our use cases or have crafted some examples of your own, feel free to add them to the example directory. Your practical insights can enrich our resource pool.
  • Fix typos/grammar mistakes.
  • Report bugs and scenarios that are difficult to implement.
  • Implement new features by making a pull-request.

✅ TODO (perhaps) #

Once you start using the IdGen, it will become easy to choose the functionality to contribute. But if you already get everything you need from this package but have some free time, let me write here what I have planned:

  • Feautures for this package into README.
  • Example of HID generation in your own language.
  • More predefined languages. 1
  • HID. A desire case convention. 1

It's just a habit of mine: writing down ideas that come to mind while working on a project. I confess that I rarely return to these notes. But now, hopefully, even if you don't have an idea yet, the above notes will help you choose the suitable "feature" and become a contributor to the open-source community.

Ready for 🪙

Created with ❤️

fresher

4
likes
160
pub points
53%
popularity

Publisher

verified publishersyrokomskyi.com

A standardized and well-tested set of IDs generators: globally unique, readable, time-dependency, transitive, incremental, decremental IDs.

Repository (GitHub)
View/report issues
Contributing

Topics

#generator #uid #uuid #time #random

Documentation

API reference

License

MIT (license)

Dependencies

meta, test, uuid

More

Packages that depend on id_gen