Skip to content

Commit 8c8ab43

Browse files
committed
Some changes before release
1 parent 42b2b47 commit 8c8ab43

File tree

6 files changed

+50
-3
lines changed

6 files changed

+50
-3
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
v4.5.0
4+
5+
* Deprecate the use of `Uuid.NAMESPACE*` and `UuidV5.NAMESPACE`, and switch to using a proper const enum for this. (thanks @bymoye)
6+
* These will be removed once sufficient time has been made for the deprecation notice to be seen. Most likely v5.0.
7+
* Please use the new `Namespace` enum in `enums.dart`.
8+
* Re-add `Uuid.NAMESPACE*` and `UuidV5.NAMESPACE` in order to give deprecation time.
9+
* Add missing MAX UUID option from RFC9562
10+
* Add `bytes` getter to `Namespace` enum.
11+
* **[PARTIAL BREAKING CHANGE]** `Namespace` is now an enum, and the entries are now of the `Namespace` type. They all have a `value` function to return the internal `string`
12+
313
v4.4.2
414

515
* Revert meta depenency version upgrade, was breaking flutter_test. (thanks @techouse)

lib/enums.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
// ignore_for_file: constant_identifier_names
22

3+
import 'package:uuid/uuid.dart';
34
import 'package:uuid/uuid_value.dart';
45

56
/// The options for UUID Validation strictness
67
enum ValidationMode { nonStrict, strictRFC4122 }
78

9+
/// RFC4122 & RFC9562 provided namespaces for v3, v5, and v8 namespace based UUIDs
810
enum Namespace {
9-
// RFC4122 provided namespaces for v3 and v5 namespace based UUIDs
1011
DNS("6ba7b810-9dad-11d1-80b4-00c04fd430c8"),
1112
URL("6ba7b811-9dad-11d1-80b4-00c04fd430c8"),
1213
OID("6ba7b812-9dad-11d1-80b4-00c04fd430c8"),
1314
X500("6ba7b814-9dad-11d1-80b4-00c04fd430c8"),
14-
NIL("00000000-0000-0000-0000-000000000000");
15+
NIL("00000000-0000-0000-0000-000000000000"),
16+
MAX("ffffffff-ffff-ffff-ffff-ffffffffffff");
1517

1618
const Namespace(this.value);
1719
final String value;
1820

1921
UuidValue get uuidValue => UuidValue.raw(value);
22+
List<int> get bytes => Uuid.parse(value, validate: false);
2023
}

lib/uuid.dart

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ export 'enums.dart';
3232
class Uuid {
3333
final GlobalOptions? goptions;
3434

35+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
36+
static const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
37+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
38+
static const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
39+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
40+
static const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
41+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
42+
static const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
43+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
44+
static const NAMESPACE_NIL = '00000000-0000-0000-0000-000000000000';
45+
3546
/// Creates a new instance of the Uuid class.
3647
/// Optionally you can pass in a [GlobalOptions] object to set global options
3748
/// for all UUID generation.

lib/uuid_value.dart

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:typed_data';
22

33
import 'package:meta/meta.dart';
44

5+
import 'enums.dart';
56
import 'parsing.dart';
67
import 'uuid.dart';
78
import 'validation.dart';
@@ -10,6 +11,17 @@ import 'validation.dart';
1011
class UuidValue {
1112
final String uuid;
1213

14+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
15+
static const dns = UuidValue.raw(Uuid.NAMESPACE_DNS);
16+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
17+
static const url = UuidValue.raw(Uuid.NAMESPACE_URL);
18+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
19+
static const oid = UuidValue.raw(Uuid.NAMESPACE_OID);
20+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
21+
static const x500 = UuidValue.raw(Uuid.NAMESPACE_X500);
22+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
23+
static const nil = UuidValue.raw(Uuid.NAMESPACE_NIL);
24+
1325
/// fromString() creates a UuidValue from a [String] with no validation.
1426
factory UuidValue.fromString(String uuid) {
1527
return UuidValue.raw(uuid.toLowerCase());

lib/v5.dart

+11
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ import 'package:crypto/crypto.dart' as crypto;
1212
class UuidV5 {
1313
final GlobalOptions? goptions;
1414

15+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
16+
static const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
17+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
18+
static const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
19+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
20+
static const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
21+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
22+
static const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
23+
@Deprecated('Please use the Namespace enum in enums.dart instead.')
24+
static const NAMESPACE_NIL = '00000000-0000-0000-0000-000000000000';
25+
1526
const UuidV5({this.goptions});
1627

1728
/// v5() Generates a namspace & name-based version 5 UUID

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: uuid
2-
version: 4.4.2
2+
version: 4.5.0
33
description: >
44
RFC4122 (v1, v4, v5, v6, v7, v8) UUID Generator and Parser for Dart
55
documentation: https://daegalus.github.io/dart-uuid/index.html

0 commit comments

Comments
 (0)