This is a package to simplify your dart code, specially classes and make your code more Classy and Elegant without the normal boilerplate
✨ Features
😎 @data
calls the @constructor, @toJson, @fromJson and @toString to generate the complete class for you.
🏗️ @constructor
it generates a constructor, and you can choose if you want NamedConstructor or PositionConstructor.
⬇️ @fromJson
to instantiate the class from a json, that normally come from a server.
⬆️ @toJson
to convert the class instance into a JSON map, which can be sent to a server or used elsewhere in your application.
📜 @toString
for a readable string representation of the class.
🚀 How to Run?
-
Add
package:classy
to yourpubspec.yaml
- Run Command
dart pub add classy
- In
pubspec.yaml
file
dependencies: classy: any
-
Add the following code into your
analysis_options.yaml
analyzer: enable-experiment: - macros
-
When you're gonna run the project:
dart run --enable-experiment=macros path/main.dart