Home > Net >  How to write data to an existing json file in flutter?
How to write data to an existing json file in flutter?

Time:05-05

How to add data to an existing json file in assets folder in flutter based on input given by user?

CodePudding user response:

Create a model as your JSON and add the fromJson toJson method. Call the model class and pass your new data init. Read this documation: https://docs.flutter.dev/development/data-and-backend/json

CodePudding user response:

You cannot do this. Assets are read-only. Read this for options on how to persist data between app runs: https://docs.flutter.dev/cookbook/persistence

  • Related