uuid_enhanced 3.0.2 uuid_enhanced: ^3.0.2 copied to clipboard
RFC4122 (v1, v4, v5) UUID Generator and Parser for all Dart platforms (Web, VM, Flutter)
dart-uuid #
Version 3.0.0 has breaking API changes
Simple, fast generation of RFC4122 UUIDs.
Features:
- Generate RFC4122 version 1, version 4, or version 5 UUIDs
- Runs in web, server, and flutter
- Cryptographically strong random number generation on all platforms
- Defaults to non-crypto generator, see UuidUtil for cryptoRNG
- API
Getting Started #
Instructions #
- Open a command line and cd to your projects root folder
- In your pubspec, add an entry for dart-uuid to your dependencies (example below)
- pub install
- If you wish to run tests, go into packages/dart-uuid/ and run 'dart test/uuid_test.dart'
Pubspec #
pub.dartlang.org: (you can use 'any' instead of a version if you just want the latest always)
dependencies:
uuid_enhanced: ^3.0.0
import 'package:uuid_enhanced/uuid_enhanced.dart';
Then create some ids ...
// Generate a v1 (time-based) id
Uuid.fromTime(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
// Generate a v4 (random) id
Uuid.randomUuid(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
// Generate a v4 (crypto-random) id
Uuid.randomUuid(random: UuidUtil.cryptoRNG());
// -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
// Generate a v5 (namespace-name-sha1-based) id
Uuid.fromName('www.google.com', namespace: Uuid.NAMESPACE_URL);
// -> 'c74a196f-f19d-5ea9-bffd-a2742432fc9c'
Testing #
In dartvm
dart test\uuid_test.dart
Benchmarking #
Its pretty quick, but no official benchmarking.
Release notes #
See CHANGELOG