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

இணையத் தணிக்கைகளும் தீர்வுகளும் - #டவுட்டுகள்

Does Fetching a Parent Collection in Firebase Firestore Return Its Entire Sub-Collection Tree?

அத்தாட்சிகள்