-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Freezed classes extending another Freezed class. #907
Comments
Probably would require disabling |
Currently we can do: sealed class B implements A {
int get moreCommonGround;
}
@freezed
sealed class A with _$A {
@Implements<B>();
factory A.c(int commonGround, int moreCommonGround) = C;
@Implements<B>();
factory A.d(int commonGround, int moreCommonGround) = D;
factory A.z(int commonGround) = Z;
} The main genefit of this proposal is:
|
Haha, I've actually been doing the implements workaround already for a few days with sealed classes. Would love to see this feature. |
@TimWhiting can you share your workaround? Trying to extend a class that uses freezed and I would hate to have to remove the freezed implementation |
This is the workaround. You can't extend the freezed class. You have to use Then just use pattern matching instead of Here is a file that uses this approach. https://github.com/byu-static-analysis-lab/syntax/blob/main/lib/src/scheme/scheme_syntax.dart Maybe you cna share your example to see if we have any more hints. Maybe inline the constructors for the freezed class you are trying to extend in the current freezed class you are creating and use this methodology to create shared implementation and relationships that was in your class you were trying to extend. |
Cases to handle:
with variants such as
The text was updated successfully, but these errors were encountered: