freezed
freezed copied to clipboard
Add `@Body`/`@Initializer` annotations
I like new @Assert
decorator very much.
But I also need @Event
decorator. :)
I think it would be very good to have custom decorators. Might they exist?
I expect something like JsonConverter
but for a constructor initialiser with overriding init method.
In generated code it would looks like this:
class Example {
Example(Params params): assert(someAssertion == true) {
@Initialiser().init?.call() // or better: call(params)
}
}
What would an @Event
do?
For events I need to send custom events like "model has been created" to a broadcaster, but this is custom code too.
What would an
@Event
do?
It's just the same idea as for @Initialiser
witch can be customised as developer want.
The idea is running any code in a class constructor body.