sqids
0.0.3, released 3 months ago by jodeveloper8.me
Generate short YouTube-looking IDs from numbers and decode them back.
WASM-ready
What it does
Generates short, URL-safe identifiers from one or several non-negative numbers using the Sqids algorithm. It allows customization of minimum length, custom alphabets, and blocklists to prevent specific words in generated IDs.
AI-written summary of version 0.0.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to generate public-facing IDs for URLs or link shortening
- You want to encode internal sequential numbers into nonconsecutive IDs
Skip it when
- You are handling sensitive data that requires proper encryption
- You are generating user IDs where revealing the count of users via decoding is undesirable
Strengths
- Fast encoding and decoding performance
- URL safe with auto-generated prevention of common profanity
- Supports custom alphabets and blocklists
Weaknesses
- Multiple IDs can decode back into the same sequence of numbers, meaning they are not strictly canonical without manual checks
- Not suitable for cryptography or sensitive data protection
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
none
final sqids = Sqids();
const id = sqids.encode([1, 2, 3]);
const numbers = sqids.decode(id);Alternatives
Packages that do the same job and could replace sqids.