uuid_type 2.2.1
uuid_type: ^2.2.1 copied to clipboard
UUID type, parser and generators. Can generate v1 and v4-v7 UUIDs
UUID type for Dart #
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
Comparablefor 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
cryptopackage
Getting Started #
Installation #
- Add an entry in your
pubspec.yamlforuuid_type
dependencies:
uuid_type: ^2.2.0
- Run
pub get(flutter packages getfor Flutter) - 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.