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

A standartized set of IDs generators.

ID Generators #

Cover - ID Generators

The standartized and well-tested set for generate identifiers.

Examples #

Generate 4 UUIDs #

About UUID (online generator): https://uuidgenerator.net

for (var i = 0; i < 4; ++i) {
    print(genUuid);
}

Output:

490833da-4976-4563-8c8a-9f5464a2bf7e
e82e3bf5-c3ea-46d6-a835-12644b99cf6e
4d86c01f-777b-4599-b28f-c87c3737c8e2
60fc6015-417e-4548-adaa-b032b1f7dbcd

Generate HID from language #

Supported languages:

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

Output:

tema-stati-chy-nazva-kursu

Generate Transit Integer ID #

print(genTransitId);
// or
print(TransitId().next);

Output:

1
2

Generate Time Integer ID #

print(genTimeId);
// or
print(genTimeIdMicro);

Output:

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.

License #

MIT

TODO #