Parkour-Labs / dust

State management all-in-one: reactivity, persistence and synchronisation.
Apache License 2.0
2 stars 0 forks source link

Migrate to `freezed`-like API #5

Closed wxxedu closed 5 months ago

wxxedu commented 5 months ago

Currently, the API requires the user to write a lot of boilerplate code. This is because in the initial design of our API, we tried to follow Isar's API design. The problem is, instead of storing fields as they are, we store the fields inside wrapper classes. Requiring the user to write wrapper classes would be too much boilerplate every time.

After looking into it, I think that it would be best if we could adapt the code generator to be based on a freezed-like style.

wxxedu commented 5 months ago

4 would be resolved upon the fixing of this issue.

wxxedu commented 5 months ago

As an initial implementation, we may have to narrow down the scope by quite a bit by rejecting some valid freezed APIs. Also since we are dealing with models and it is unclear yet how a model would be having an "algebraic" type, we would disallow the syntax for "freezed" unions as well. -- they may be a good way of dealing with migrations...

For now, we assume that in the freezed factory constructor, only named constructors are applied.

wxxedu commented 5 months ago

Todos:

wxxedu commented 5 months ago

I would say that #6 and #7 are not that relevant to this issue and may be sort-of separate to this freezed-migration thing. Hence, let's close this issue for now.