How to check entered phone number is valid or not with flutter?

by Shruti Ramnandan Sharma   Last Updated August 14, 2019 04:26 AM

I'm trying to check to entered phone number is valid or not . means, if I enter the wrong number which does not exist in the world, so it shows me a toast with content "Please enter a valid number"

 Expanded(
   child: TextField(
     keyboardType: TextInputType.phone,
     decoration: InputDecoration(
       border: InputBorder.none, 
       hintText: "Phone Number", 
     ),
     onChanged: (value){
      setState(() {
        phoneValue=value; 
      });
     //String telNo = value==null?("+91" + value) :null;
     print("phoneNumbe:$phoneNo");
     this.phoneNo = isCountryCodeSelected ? "+" + countryCode + value : "+91" + value ;
     print("phoneNo="+phoneNo);
    },
   ),
 )
Tags : flutter dart


Related Questions


Updated July 13, 2019 11:26 AM

Updated July 26, 2018 20:26 PM

Updated August 26, 2018 17:26 PM

Updated August 17, 2018 16:26 PM