Relative Content

Tag Archive for flutterdarthttpproviderstate-management

Flutter Bug Where I have to Click the Button Twice

I get this weird problem in Flutter. I’m using ‘Provider’ for state management, In the helper class everything is fine, I’m sending the request and I receive the response with no problems. The problem occurs in the button event handler. The first time I click the button literally nothing happens, when I click it the second time it talks to the API and gets the data. Another problem is: when I enter correct data and they are sent to the API, Immediately after that, I enter wrong credentials the app tells me that I’ve entered correct credentials as if I’m dealing with the same previous object.
Here is my code for the front-end part:

Flutter Bug Where I have to click button twice

I get this weird problem in Flutter. I’m using ‘Provider’ for state management, In the helper class everything is fine, I’m sending the request and I receive the response with no problems. The problem occurs in the button event handler. The first time I click the button literally nothing happens, when I click it the second time it talks to the API and gets the data. Another problem is: when I enter correct data and they are sent to the API, Immediately after that, I enter wrong credentials the app tells me that I’ve entered correct credentials as if I’m dealing with the same previous object.
Here is my code for the front-end part: