User Attributes Custom Hook in React Native

In today's code-read, I learned a smart way to use a custom hook and generate objects from that. A brief background first about what we are trying to achieve. Let's say we have an user object and inside that object we have a property called attributions This is an interesting property, it's of type array and all the attributes of a user are coming as key-value pair. The user object looks like below Now let's assume this user object is globally set (as it should be) and we want to show these attributes in different screens and components inside our…

An example of a simple API call to update a user profile data in Flutter.

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…