Flutter TextField value always uppercase & debounce
Solution 1:
Works on Android, iOS, Web, macOS, Windows and Linux
You can implement a custom TextInputFormatter
class UpperCaseTextFormatter extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
return TextEditingValue(
text: newValue.text.toUpperCase(),
selection: newValue.selection,
);
}
}
Usage:
TextField(
inputFormatters: [
UpperCaseTextFormatter(),
]
)
Full example
Solution 2:
Perhaps using textCapitalization: TextCapitalization.characters in the TextField could help you? Although this would capitalize the characters while something is being typed as well.
TextField(
textCapitalization: TextCapitalization.sentences,
)