short_readable_id
A short human readable and easily memorable unique id generator.
Generating short human readable id
void main() {
print(idGenerator.generateReadable()); // => VVGU-976
}
Configuring separator
Use separator
parameter to configure the separator used
between alphabetical and numerical parts of the id.
void main() {
print(idGenerator.generateReadable(separator: '')); // => VVGU976
}
Generating short id
void main() {
print(idGenerator.generate()); // => 1YQOBQO
}
Choose date reference
The parameter refDate
lets the programmer configure reference date that
is used to generate a part of the generated id. The most recent date you
pick, the shorter will be the generated id.
void main() {
final gen = IdGenerator(refDate: DateTime(2050));
}
Worker id
Worker id is used to generate the id to make sure ids generated by multiple
concurrent id generators do not conflict. Configure worker id using workerId
parameter.
void main() {
final gen = IdGenerator(workerId: 5);
}
Libraries
- short_readable_id
- A short human readable and easily memorable unique id generator.