Sitemap

Flutter Loading States

Feb 12, 2024

--

we all know what is the meaning of handle all application states ,
we need to handle muliple states like exception form network time out,no connection ,application loading, data is empty, then we write a lot of redundent code to handle all that states in this article i am going to share with you how to handle all that states using cleaner way.
1- the first of all we are going to crrate seald class that holds our application states like the following:

Press enter or click to view image in full size

Get Aymanomara’s stories in your inbox

Join Medium for free to get updates from this writer.

2- secondly we are going to create our loading widget :

Press enter or click to view image in full size

and now all we have to do is using the LoadingWidget with our states
3- now our widget tree will be very clean and straight forwerd
like the following

Press enter or click to view image in full size

--

--