Open Tienisto opened 1 week ago
Looks reasonable and feel free to PR for this! Alternatively, I may work on it later but may not be top priority, since it is not a bug and has workaround (i.e. introducing the freezed
dependency which is a super popular package).
A workaround before it is implemented: Maybe you can firstly introduce freezed dependency and generate the code, and then copy-paste or modify the code, such that the freezed dependency is removed (should not be too hard since that runtime package seems only contain some utility).
Btw checked https://pub.dev/packages/rhttp and seems it depends on freezed_annotation
, which looks like quite lightweight and high-quality (https://pub.dev/packages/freezed is an official Flutter Favorite
package).
Another thing may be, we may also ask on the freezed
repo about whether the dependency can be eliminated. That seems to be more general purposed (if it is done, every lib using freezed will reduce dependency) than the current proposal (if it is done, only lib using frb+freezed will reduce dependency)
Is your feature request related to a problem? Please describe. When using enum sum types in Rust like
Then FRB generates
However, since Dart 3.0 is supported, we can remove the freezed annotation and generate the classes ourself:
This is useful to minimize the amount of dependencies if freezed is never used elsewhere.
Describe the solution you'd like Add option to use sealed classes instead of freezed for enum sum types.
Describe alternatives you've considered None.
Additional context For https://github.com/Tienisto/rhttp