slugid
1.1.2, released 4 years ago by google.dev
URL-safe base64 encoded UUIDv4 without padding
WASM-readyQuiet but busy
What it does
Creates a 22‑character slugid by encoding a random UUIDv4 in URL‑safe base64 and stripping the trailing ‘==’. It also offers a ‘nice’ variant that avoids leading ‘-’.
AI-written summary of version 1.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need short, URL‑friendly unique identifiers
- Use in command‑line tools where leading ‘-’ is undesirable
- Embed identifiers in URLs or file names
Skip it when
- Require full 36‑character UUID format
- Need cryptographic‑grade randomness beyond UUIDv4
- Need deterministic IDs
Strengths
- Compact 22‑char representation
- URL‑safe, no padding
- Simple API, no build_runner
- Cross‑platform support
Weaknesses
- Not a full UUID string, so not compatible with systems expecting 36 chars
- Nice variant reduces entropy slightly
- No namespace or version control beyond v4
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Slugid slug = Slugid.v4();
print(slug.toString());Alternatives
Packages that do the same job and could replace slugid.
Works with
Packages commonly used together with slugid: ones it builds on, ones built on it, and its own family.