uuid static method
Implementation
static String uuid(Object? value) {
if (value is! String) throw const FormatException('Invalid BLE UUID.');
var text = value.toLowerCase();
if (RegExp(r'^[0-9a-f]{4}$').hasMatch(text)) text = '0000$text';
if (RegExp(r'^[0-9a-f]{8}$').hasMatch(text)) {
text = '$text-0000-1000-8000-00805f9b34fb';
}
if (!RegExp(
r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$',
).hasMatch(text)) {
throw const FormatException('Invalid BLE UUID.');
}
return text;
}