diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fd1218..f1809be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +v4.3.1 + +* Add additional optional parameters for parseing and validation for the new noDashes flag. + v4.3.0 * Update SDK constraints to >= 3.0.0 diff --git a/lib/parsing.dart b/lib/parsing.dart index c08a197..cde64a0 100644 --- a/lib/parsing.dart +++ b/lib/parsing.dart @@ -40,16 +40,15 @@ class UuidParsing { /// Throws [RangeError] if a [buffer] is provided and it is too small. /// It is also thrown if a non-zero [offset] is provided without providing /// a [buffer]. - static List parse( - String uuid, { - List? buffer, - int offset = 0, - bool validate = true, - ValidationMode validationMode = ValidationMode.strictRFC4122, - }) { + static List parse(String uuid, + {List? buffer, + int offset = 0, + bool validate = true, + ValidationMode validationMode = ValidationMode.strictRFC4122, + bool noDashes = false}) { if (validate) { UuidValidation.isValidOrThrow( - fromString: uuid, validationMode: validationMode); + fromString: uuid, validationMode: validationMode, noDashes: noDashes); } var i = offset, ii = 0; @@ -96,12 +95,14 @@ class UuidParsing { {List? buffer, int offset = 0, bool validate = true, - ValidationMode validationMode = ValidationMode.strictRFC4122}) { + ValidationMode validationMode = ValidationMode.strictRFC4122, + bool noDashes = false}) { return Uint8List.fromList(parse(uuid, buffer: buffer, offset: offset, validate: validate, - validationMode: validationMode)); + validationMode: validationMode, + noDashes: noDashes)); } /// Unparses a [buffer] of bytes and outputs a proper UUID string. diff --git a/lib/uuid_value.dart b/lib/uuid_value.dart index 6fa4f9c..173b919 100644 --- a/lib/uuid_value.dart +++ b/lib/uuid_value.dart @@ -30,9 +30,10 @@ class UuidValue { /// the uuid string. /// Throws [FormatException] if the UUID is invalid. factory UuidValue.withValidation(String uuid, - [ValidationMode validationMode = ValidationMode.strictRFC4122]) { + [ValidationMode validationMode = ValidationMode.strictRFC4122, + bool noDashes = false]) { final uuidValue = UuidValue.fromString(uuid); - uuidValue.validate(validationMode); + uuidValue.validate(validationMode, noDashes); return uuidValue; } @@ -61,9 +62,10 @@ class UuidValue { /// the uuid string. /// Throws [FormatException] if the UUID is invalid. void validate( - [ValidationMode validationMode = ValidationMode.strictRFC4122]) { + [ValidationMode validationMode = ValidationMode.strictRFC4122, + bool noDashes = false]) { UuidValidation.isValidOrThrow( - fromString: uuid, validationMode: validationMode); + fromString: uuid, validationMode: validationMode, noDashes: noDashes); } // toBytes() converts the internal string representation to a list of bytes. diff --git a/pubspec.yaml b/pubspec.yaml index a3c6d41..42c7bb7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: uuid -version: 4.3.0 +version: 4.3.1 description: > RFC4122 (v1, v4, v5, v6, v7, v8) UUID Generator and Parser for Dart documentation: https://daegalus.github.io/dart-uuid/index.html