toCamelCase method
Converts a string to camelCase naming convention.
text
- The input text to convert.
Splits on underscores, hyphens, and spaces, then converts to camelCase. Example: 'user_profile' → 'userProfile'
Implementation
String toCamelCase(String text) {
if (text.isEmpty) return text;
final words = text.split(RegExp(r'[_\-\s]+'));
return words.first.toLowerCase() +
words.skip(1).map((word) => word.capitalize()).join();
}