-
Notifications
You must be signed in to change notification settings - Fork 183
Open
Description
Is your feature request related to a problem? Please describe.
The upgrade to the Freezed package from v2 to v3 comes with a breaking change in the syntax. Specifically, "Classes using the factory constructor now require a keyword sealed / abstract." (details here)
Describe the solution you'd like
- Create a new major version of the flutter-freezed plugin that automatically includes
sealed/abstractkeyword. Create a config flag that allows the user to specify if they want to add.sealed/abstractbefore the class definition based on the version of Freezed they are using
Describe alternatives you've considered
I've done a global replace on the file generated by the plugin add 'abstract' before the 'class' keyword.
So that this:
@freezed
class Report with _$Report {
const Report._();
const factory Report({
required final String name
}) = _Report;
factory Report.fromJson(Map<String, dynamic> json) =>
_$ReportFromJson(json);
}
//...Becomes:
@freezed
abstract class Report with _$Report {
const Report._();
const factory Report({
required final String name
}) = _Report;
factory Report.fromJson(Map<String, dynamic> json) =>
_$ReportFromJson(json);
}
//......and that works as expected.
Additional context
The change to Freezed is described here.
To: @Parables
Metadata
Metadata
Assignees
Labels
No labels