Flutter TextField value always uppercase & debounce Flutter TextField value always uppercase & debounce dart dart

Flutter TextField value always uppercase & debounce


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


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,)


Everything you need to do is:

After String put .toUpperCase()

Example: "Some text".toUpperCase()

This worked in my case. I am new too, so I hope I helped.