Skip to main content

uuid_type 2.2.0 copy "uuid_type: ^2.2.0" to clipboard
uuid_type: ^2.2.0 copied to clipboard

UUID type, parser and generators. Can generate v1 and v4-v7 UUIDs

UUID type for Dart #

CI pub package License

This package provides implementation of Universally Unique Identifier (UUID) for Dart, and supports generation, parsing and formatting of UUIDs.

Features #

  • ✅ Creates UUIDs from strings and byte arrays, including GUID and URN strings
  • ✅ Provides access to UUID variant, version, and byte data
  • ✅ Generates RFC 9562 versions 1, 4, 5, 6, and 7 UUIDs
  • ✅ Implements Comparable for UUID comparison and lexicographical sorting
  • ✅ Runs on the web, server, and Flutter

RFC version support #

  • ✅ v1, based on timestamp and MAC address
  • ❌ v2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) Not planned
  • ❌ v3, based on MD5 hashing Not planned
  • ✅ v4, based on random numbers
  • ✅ v5, based on SHA-1 hashing
  • ✅ v6, a time-ordered reordering of UUID version 1
  • ✅ v7, a Unix Epoch time-based UUID
  • ❌ v8, A free-form UUID format which has no explicit requirements except maintaining backward compatibility.

Requirements #

  • Dart SDK ^3.8.0
  • crypto package

Getting Started #

Installation #

  1. Add an entry in your pubspec.yaml for uuid_type
dependencies:
  uuid_type: ^2.1.0
  1. Run pub get (flutter packages get for Flutter)
  2. Import
import 'package:uuid_type/uuid_type.dart';

Usage #

Generate UUIDs

import 'package:uuid_type/uuid_type.dart';

void main() {
  var u = TimeUuidGenerator().generate();
  print(u.toString());

  u = NameUuidGenerator(NameUuidGenerator.urlNamespace).generateFromString('https://dart.dev/');
  print(u.toString());

  u = RandomUuidGenerator().generate();
  print(u.toString());
}

See more examples and documentation.

Release notes #

See CHANGELOG

Features and Bugs #

Please file bugs and feature requests at the issue tracker.

17
likes
160
points
7.39k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

UUID type, parser and generators. Can generate v1 and v4-v7 UUIDs

Repository (GitHub)
View/report issues

Topics

#uuid

License

MIT (license)

Dependencies

crypto

More

Packages that depend on uuid_type