Skip to content
pubscout

ulid

2.2.0, released 2 months ago by agilord.com

Lexicographically sortable 128-bit identifier generator.

WASM-ready
$ flutter pub add ulid
Source repository

What it does

Generates 128-bit identifiers combining a 48-bit timestamp and 80 random bits, canonically encoded as 26-character strings. It provides sortable IDs that replace traditional UUIDs when chronological ordering is required.

AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need unique identifiers that are also sortable by creation time.
  • You prefer 26-character strings over traditional 36-character UUIDs.

Skip it when

  • You only need standard random UUIDs without timestamp sorting requirements.

Strengths

  • Lexicographically sortable by time
  • Supports custom random sources and monotonic increments via UlidFactory
  • Cross-platform support including Dart-only web and mobile

Weaknesses

  • Some older methods like toCanonical are deprecated in favor of toBase32
  • toString casing behavior is scheduled to change in a future major version

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:ulid/ulid.dart';

void main() {
  print(Ulid());
  print(Ulid().toUuid());
  print(Ulid().toBase32());
}

Alternatives

Packages that do the same job and could replace ulid.

  • uuid

    If you need standard RFC-compliant UUIDs instead of ULIDs.