Skip to content

Commit

Permalink
Added validate option to toBytes. Also ran dart format, because of gi…
Browse files Browse the repository at this point in the history
…t CI fail.
  • Loading branch information
Erhannis authored and daegalus committed Aug 30, 2023
1 parent 8a49c14 commit 3416381
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
26 changes: 11 additions & 15 deletions lib/uuid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class Uuid {
/// ```
String v1(
{@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V1Options? config}) {
if (options != null && options.isNotEmpty) {
config = V1Options(options["clockSeq"], options["mSecs"],
Expand Down Expand Up @@ -199,7 +199,7 @@ class Uuid {
List<int> v1buffer(
List<int> buffer, {
@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V1Options? config,
int offset = 0,
}) {
Expand Down Expand Up @@ -234,7 +234,7 @@ class Uuid {
/// ```
UuidValue v1obj(
{@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V1Options? config}) {
return config != null
? UuidValue(v1(config: config))
Expand Down Expand Up @@ -299,7 +299,7 @@ class Uuid {
/// ```
String v4(
{@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V4Options? config}) {
if (options != null && options.isNotEmpty) {
var rng = options["rng"];
Expand Down Expand Up @@ -338,7 +338,7 @@ class Uuid {
List<int> v4buffer(
List<int> buffer, {
@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V4Options? config,
int offset = 0,
}) {
Expand Down Expand Up @@ -374,7 +374,7 @@ class Uuid {
/// ```
UuidValue v4obj(
{@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V4Options? config}) {
return config != null
? UuidValue(v4(config: config))
Expand All @@ -400,11 +400,9 @@ class Uuid {
/// uuid.v5(Uuid.NAMESPACE_URL, 'www.google.com');
/// // -> "c74a196f-f19d-5ea9-bffd-a2742432fc9c"
/// ```
String v5(
String? namespace,
String? name,
String v5(String? namespace, String? name,
{@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V5Options? config}) {
if (options != null && options.isNotEmpty) {
V4Options? v4config;
Expand Down Expand Up @@ -441,7 +439,7 @@ class Uuid {
String? name,
List<int>? buffer, {
@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V5Options? config,
int offset = 0,
}) {
Expand Down Expand Up @@ -472,11 +470,9 @@ class Uuid {
/// print(uuidValue) -> // -> 'c74a196f-f19d-5ea9-bffd-a2742432fc9c'
/// uuidValue.toBytes() -> // -> [...]
/// ```
UuidValue v5obj(
String? namespace,
String? name,
UuidValue v5obj(String? namespace, String? name,
{@Deprecated('use config instead. Removal in 5.0.0')
Map<String, dynamic>? options,
Map<String, dynamic>? options,
V5Options? config}) {
return config != null
? UuidValue(v5(namespace, name, config: config))
Expand Down
4 changes: 2 additions & 2 deletions lib/uuid_value.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class UuidValue {
}

// toBytes() converts the internal string representation to a list of bytes.
Uint8List toBytes() {
return UuidParsing.parseAsByteList(uuid, validate: false);
Uint8List toBytes({bool validate = false}) {
return UuidParsing.parseAsByteList(uuid, validate: validate);
}

// toString() returns the String representation of the UUID
Expand Down

0 comments on commit 3416381

Please sign in to comment.