isValidUUID static method

bool isValidUUID(
  1. String uuid
)

Validates if the given string is a valid UUID.

Implementation

static bool isValidUUID(String uuid) {
  final regex = RegExp(
      r'^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\$');
  return regex.hasMatch(uuid);
}