isValidFormatOrThrow static method

void isValidFormatOrThrow({
  1. String fromString = '',
  2. Uint8List? fromByteList,
  3. bool noDashes = false,
})

Validates that the input is exactly a 128-bit hexadecimal value.

Throws a FormatException when isValidUUIDFormat returns false.

Implementation

static void isValidFormatOrThrow({
  String fromString = '',
  Uint8List? fromByteList,
  bool noDashes = false,
}) {
  final isValid = isValidUUIDFormat(
    fromString: fromString,
    fromByteList: fromByteList,
    noDashes: noDashes,
  );

  if (!isValid) {
    throw FormatException(
      'The provided UUID has an invalid format.',
      fromByteList ?? fromString,
    );
  }
}