Skip to main content

uuid58 0.1.1 copy "uuid58: ^0.1.1" to clipboard
uuid58: ^0.1.1 copied to clipboard

Shorten UUIDs to 22-character Base58 strings, and back. Order-preserving, with a stable, well-tested spec. Pure Dart: works on the VM, Flutter, and the web.

example/example.dart

import 'package:uuid58/uuid58.dart';

void main() {
  final id = uuid58Encode('f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf');
  print(id); // XDY9dmBbcMBXqcRvYw8xJ2

  print(uuid58Decode(id)); // f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf
  print(uuid58DecodeBytes(id)); // [244, 178, 71, 253, ...]

  print(isUuid58(id)); // true
  print(isUuid58('zzzzzzzzzzzzzzzzzzzzzz')); // false: exceeds 128 bits

  try {
    uuid58Decode('not a uuid58');
  } on Uuid58Exception catch (e) {
    print(e.kind.code); // invalid_length
  }

  print(uuid58()); // a random UUIDv4, encoded
}
0
likes
160
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Shorten UUIDs to 22-character Base58 strings, and back. Order-preserving, with a stable, well-tested spec. Pure Dart: works on the VM, Flutter, and the web.

Homepage
Repository (GitHub)
View/report issues

Topics

#uuid #base58 #encoding #id #short-id

License

MIT (license)

More

Packages that depend on uuid58