Giter Site home page Giter Site logo

Comments (2)

gadfly361 avatar gadfly361 commented on July 24, 2024 1

@MarcelGarus Thanks for the detailed response! I am going to close this in favor of tracking #4

from data_classes.

MarcelGarus avatar MarcelGarus commented on July 24, 2024

Hmm good question. I guess we could try to add a meta-anmotation like
@Annotation(JsonSerializable()) to the mutable class to then add the actual annotation @JsonSerializable() to the generated class.
But I'm not even sure you can add annotations in generated files...
Also, this issue doesn't have the highest priority right now, so it'll take some time until I evaluate/implement this. Of course you're welcome to contribute to the project, if you want to!
In the meantime, you can of course add @JsonSerializable to the mutable class and use User.toMutable().toJson() and User.fromMutable(MutableUser.fromJson(json)) although this is more boilerplate.
Oh and also, take into consideration that static extension methods are actively being worked on by the Dart team right now, so soon you'll be able to define User.toJson() => this.toMutable().toJson() in the original file.

from data_classes.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.