generateRouteCLID static method
Generate a deterministic CLID for a route
Implementation
static String generateRouteCLID(String locationCLID, Route route) {
// Validate required fields
final validation = _validateRoute(route);
if (!validation.isValid) {
throw ArgumentError(
'Invalid route data: ${validation.errors.join(', ')}',
);
}
// Extract location UUID (remove prefix)
final locationUuid = locationCLID.replaceFirst('clid:location:', '');
// Build deterministic components
final components = [
locationUuid,
StringUtils.normalize(route.name),
StringUtils.standardizeGrade(route.grade),
route.firstAscent?.year?.toString() ?? '',
route.firstAscent?.name != null
? StringUtils.normalize(route.firstAscent!.name!)
: '',
route.height?.toStringAsFixed(1) ?? '',
];
final input = components.join(':');
final uuid = _uuid.v5(crushlogNamespace, input);
return 'clid:v1:route:$uuid';
}