Flutter Uploading Data through API

50 Views Asked by At

I am Uploading data through API in the backed but during the upload time i want that screen should freeze and person can't click on the same button until the previous data is stored. Is it possible in Flutter

1

There are 1 best solutions below

0
On

Flutter is declarative, in that: UI = F(state). UI is a function of state.

If you want to lock something in the UI, set a state variable to indicate this and have the UI respond to this.

More specifically, for instance set a isLoading style state variable (be it through a stateful widgets setState or a state management approach, e.g. Provider) when your API call starts and then set it back to false once the API call ends. In your UI then have the UI block either the whole page, or the button in question, if that state variable isLoading == true