0

I am developing an application with Flutter. I put TextFormField. I want to prevent entering numbers in this TextFormField. How can I do that?

1
  • On what platforms does your app run (iOS, Android, browser, macOS etc) ? Commented Sep 14, 2022 at 22:06

3 Answers 3

5

Try this:

TextFormField(
 inputFormatters: <TextInputFormatter>[
      FilteringTextInputFormatter.deny(RegExp('[0-9]')),
  ], 
),
Sign up to request clarification or add additional context in comments.

Comments

3

You can use the validator argument to create a callback if the user input a number. You can also add the keyboardType argument to limit the user to only text with the value TextInputType.text

Comments

1
   inputFormatters: [
                      FilteringTextInputFormatter.deny(RegExp("[0-9]")),
                    ],

You need to add this

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.