Answers for "how to allow only numbers in input field in flutter"

6

flutter to allow numbers only textfield

TextField(
            keyboardType: TextInputType.number,
            inputFormatters: <TextInputFormatter>[
              FilteringTextInputFormatter.digitsOnly
            ], // Only numbers can be entered
          ),
Posted by: Guest on August-12-2021
2

allow only integer input flutter

import 'package:flutter/services.dart';

new TextField(
	decoration: new InputDecoration(labelText: "Enter any number"),
	keyboardType: TextInputType.number,
	inputFormatters: <TextInputFormatter>[
    	FilteringTextInputFormatter.digitsOnly
	], // Only numbers can be entered in this input field
 ),
Posted by: Guest on May-20-2021
0

how to allow only characters and numbers in textfield flutter

inputFormatters: [new  WhitelistingTextInputFormatter(RegExp("[a-zA-Z0-9]")),],
Posted by: Guest on June-04-2021

Code answers related to "how to allow only numbers in input field in flutter"

Browse Popular Code Answers by Language