0

I am newbie for Flutter. I have just created sample application using JSON Parsing.

Before I have done it using manual classes but currently I have changed my code to json_serializable and you can check the difference here.

It is okay for one or two model class which you need to change with fromJson and toJson methods but What to do when our project has 50+ model classes.

Any idea to write all the classes with easy way?

Do let me know If you need other information. Thank you.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437

1 Answers1

0

I don't think there is an automated way built to do this. You are going to have to do the changes manually.

To make it easier, you can create a snippet in vscode to generate the new toJson and fromJson methods How to add custom code snippets in VSCode?

But as the variable names are different from the JSON keys, you will need to add that by yourself.

jamesblasco
  • 1,744
  • 1
  • 9
  • 25