This post is just my quick note on how to limit the soft keyboard to allow only digits.
Please note that on iOS, we just need to use keyboardType: TextInputType.number
However on Android, we need to set inputFormatters. The keyboard on Android still shows the dot ( . ) and hyphen ( – ), but we can not add them to the text field.
TextField( inputFormatters: [ FilteringTextInputFormatter.digitsOnly, ], keyboardType: TextInputType.number, ),