-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Freezed model throws error on code generation #268
Comments
Update: I seem to have solved the second issue by deleting the 2 generated files and running the build runner again. Error: The first one is still a bummer as I have to rename the file everytime after running the build runner. |
I'm having these issues constantly too and the only solution is to close-reopen vscode. |
Do you have an error in the terminal, or is it just the IDE? If that's what I'm thinking about, the way I go around this is using cmd + hovering the "part" |
This might be related dart-lang/sdk#43166 |
@rrousselGit I think it was just IDE but due the error I was unable to compile the app. This might've been the weirdest bug I've encountered. To bypass this I eventually had to change the name of the file from |
The class 'x' doesn't have a constructor named '_'. |
Describe the bug
Unable to generate freezed classes for models.
To Reproduce
I have this model file named
activity.dart
. I've highlighted the errors I'm getting from VSCode in the comments.It's a simple freezed class. To circumvent the first
dart part_of_different_library
issue, I've to rename the file toActivity.dart
after runningflutter pub run build_runner build --delete-conflicting-outputs
Haven't found a solution to the second constructor issue. Do let me know if I'm missing something here. I have similar 7-8 model classes and they all seem to be working fine.
Expected behavior
Freezed and JSONSerializable should generate 2 files without error.
activity.g.dart
andactivity.freezed.dart
The text was updated successfully, but these errors were encountered: