Flutter Handling Null Value in TextField

 I am writing this post for my self reference. I got serious issues when I parse a TextField value to a double or any other data type. 



This will throw exception when you clear the TextField. 

So I add if condition like this. 


Again, this throws error while clearing the TextField. 

To avoid this issue, we can add a TextEditingController for the TextField and check whether the field is empty. 


Happy Coding! 






Comments

Popular posts from this blog

அல்நாசர் நினைவுகள்

August 03, 1990

Type in Tamil - Google IME