convertToFormat function
Implementation
String convertToFormat(String hex) {
// Clean & uppercase
hex = hex.toUpperCase().replaceAll(RegExp(r'[^A-F0-9]'), '');
// Pad to 36 characters
while (hex.length < 36) {
hex += '0';
}
// Split into 6 groups of 6
final groups = <String>[];
for (int i = 0; i < 36; i += 6) {
groups.add(hex.substring(i, i + 6));
}
log(groups.join('-').toString());
return groups.join('-');
}