When you are getting the data from API, the data is in the form of JSON.
For example we will take student information as a JSON file, which contains student id, name and address
To use in our flutter project we need to create a student class which is having the arguments like student id, name and address
For this we have to parse the JSON data and added to our student object
But if we have more JSON files then we have to write the code for all the classes, instead of that we can use one simple process is nothing but JSON serializable
For this we need to add 3 packages one is for seriazation and another one is for annotations and the last one is for build runner
Now, we are at climax, here what we have to do is
So, here we are adding user.g.part is nothing but part file of original User class file, and adding two methods fromJson and ToJson.
And finally, we have to run a command in terminal like below
flutter packages pub run build_runner build
It will generates the dart class, That’s it.
Thanks for reading, if you like my article please applaud.