snakifyDeviceName function
Returns deviceName with uppercase latin replaced by lowercase, and whitespace replaced with underscores. Note that multiple consecutive whitespace characters will be replaced by a single underscore.
Implementation
String snakifyDeviceName(String deviceName) {
return deviceName.toLowerCase().replaceAll(RegExp(r'\s+'), '_');
}