Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tejainece/short_readable_id

A short human readable and easily memorable unique id generator.
https://github.com/tejainece/short_readable_id

Last synced: about 2 months ago
JSON representation

A short human readable and easily memorable unique id generator.

Awesome Lists containing this project

README

        

# short_readable_id

A short human readable and easily memorable unique id generator.

# Generating short human readable id

```dart
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.

```dart
void main() {
print(idGenerator.generateReadable(separator: '')); // => VVGU976
}
```

# Generating short id

```dart
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.

```dart
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.

```dart
void main() {
final gen = IdGenerator(workerId: 5);
}
```