titleCase property
JsonCraftFormatter
get
titleCase
Implementation
static JsonCraftFormatter get titleCase => JsonCraftFormatter(
name: 'titleCase',
formatter: (value, param, getValue) {
// Se a string for apenas espaços em branco, preserva como está
if (value.trim().isEmpty) {
return value;
}
return value
.split(RegExp(r'[\s_-]+'))
.where((word) => word.isNotEmpty) // Remove palavras vazias
.map((word) =>
word[0].toUpperCase() + word.substring(1).toLowerCase())
.join(' ');
},
);