short_readable_id 1.5.1

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);
}

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  short_readable_id: ^1.5.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:short_readable_id/short_readable_id.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
11
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:short_readable_id/short_readable_id.dart.

Health suggestions

Fix lib/src/id.dart. (-2.48 points)

Analysis of lib/src/id.dart reported 5 hints:

line 46 col 7: DO use curly braces for all flow control structures.

line 73 col 7: DO use curly braces for all flow control structures.

line 103 col 7: DO use curly braces for all flow control structures.

line 105 col 7: DO use curly braces for all flow control structures.

line 108 col 10: The method '_format16' isn't used.

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and short_readable_id.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0

Admin