-
-
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
Import alias v2 #628
Comments
@rrousselGit any workaround other than manually editing the generated file everytime? I depend heavily on freezed in my app and this is causing alot of problems since I have many conflicting imports in my freezed classes?? I am also running the generator in "watch" mode so every code change triggers rebuild of the freezed files as well. |
I'm seeing this with code that looks basically like: @freezed
class MyType with _$MyType {
const factory MyType({
required myalias.OtherType ot1,
required List<myalias.OtherType> ot2,
}) = _MyType;
} The alias for mixin _$MyType {
n1.OtherType get ot1 => throw _privateConstructorUsedError;
List<OtherType> get ot2 => throw _privateConstructorUsedError; // this line errors |
yes,I bump into this bug too.Import a freezed class with alias will lost the alias on its CopyWith method in generated file.Its seems like the #519 |
I can imagine the magnitude of addressing this bug, but this issue is only going to get worse as more and more flutter packages are developed. We have classes with names such as User and Message that produce conflicts, and another situation where two external packages also produce a conflict. At the moment, we have to wrap our conflicts with another freezed shell model which works, but it is not a pretty or sustainable solution for freezed future use. |
I won't work on this until we have metaprogramming. Metaprogramming involves a complete rewrite of Freezed, and comes natively with a solution to this problem. I don't want to put a lot of effort into this when it's naturally going to disappear. |
So unfortunate this bug still exists... |
all we can do now is waiting the Metaprogramming |
Encountered this issue with |
They are discussing here,it seems like it's not going to completed right away. |
Hey i'm also facing this issue. First of all thanks for this awesome package <3. I now it's not being fixed until metaprograming is released, but maybe it could be a warning of this issue as a current "limitation" of the package at the doc. |
This bug is marked as closed, but as of 18th Sep. 2021 and version 0.14.5 - it is not (fully fixed). Example:
Now, this will generate the following syntax errors in .freezed file:
Currently, my workaround is to edit the .freezed files manually adding the prefix everywhere where there are syntax errors:
core.$ProfileCopyWith<$Res>
@rrousselGit : Please advise if I should open a new bug for this, alternatively, this bug probably should be repoened.
Originally posted by @matekdk in #70 (comment)
The text was updated successfully, but these errors were encountered: