rinukkusu / spotify-dart

A dart library for interfacing with the Spotify API.
BSD 3-Clause "New" or "Revised" License
206 stars 93 forks source link

Enable `createToJson` for the models #212

Closed KRTirtho closed 6 months ago

KRTirtho commented 7 months ago

In my app, there are many situations where I need to save/cache any response received from Spotify server. spotify-dart providers me the option to instantiate the models from Json/Map, but the option to converting the models to Json/Map isn't available. Since, spotify-dart uses JsonSerializable to achieve serialization, we can simply toggle on the toJson method generation.

Also, I'm curious about why createToJson is set to false and will be grateful if you let us know. My guess is dependency size, but dart removes dead/unused code, so that shouldn't be a problem.