We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'd like to use my own default Freezed annotation that has default parameter values (e.g toJson: true). So Instead of:
toJson: true
import 'package:freezed_annotation/freezed_annotation.dart'; part 'my_model.freezed.dart'; @Freezed(toJson: true) class MyModel with _$MyModel { const factory MyModel({ required String name, }) = _MyModel; }
I want:
import 'package:freezed_annotation/freezed_annotation.dart'; part 'my_model.freezed.dart'; class MyFreezed extends Freezed { const MyFreezed({ super.unionKey, super.unionValueCase, super.fallbackUnion, super.copyWith, super.equal, super.toStringOverride, super.fromJson, super.toJson = true, super.map, super.when, super.makeCollectionsUnmodifiable, super.addImplicitFinal, super.genericArgumentFactories, }); } @MyFreezed() class MyModel with _$MyModel { const factory MyModel({ required String name, }) = _MyModel; }
Note that I don't want to create an instance of Freezed, instead I want to subclass Freezed so I can also set other parameters as needed.
The problem is that this crashes the build runner:
[SEVERE] freezed on lib/my_model.dart: Null check operator used on a null value
Package versions:
The text was updated successfully, but these errors were encountered:
Extending the annotation is not supported.
You can do:
const myFreezed = Freezed(toJson: true)
Sorry, something went wrong.
rrousselGit
No branches or pull requests
I'd like to use my own default Freezed annotation that has default parameter values (e.g
toJson: true
).So Instead of:
I want:
Note that I don't want to create an instance of Freezed, instead I want to subclass Freezed so I can also set other parameters as needed.
The problem is that this crashes the build runner:
Package versions:
The text was updated successfully, but these errors were encountered: