Today I learned in flutter how to work with API. In my use-case, I am updating user profile data. So the flow is when the user profile edit screen first mounts – I load current user data from API and put the user details as an initial value in their respective input fields. I just have the user’s first name and last name. This is the initial step.
Now the main part is to update the user profile with the API call. So on the save function I use dio to update the user profile with a new user first name and last name from InputController text.
Finally the update API call looks like this –
I will write a more proper example with working demo later. 🙂