What is the idiomatic way to limit input in a Flutter TextField
only to these values which match the regexp ^[0-9]+(\.[0-9]+)$
?
Asked
Active
Viewed 88 times
0

porton
- 5,214
- 11
- 47
- 95
1 Answers
0
Use the property inputFormatters
return TextField(
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(^[0-9]+(\.[0-9]+)$)),
],
);
I hope this helps.

Arijeet
- 935
- 5
- 19