Created
March 16, 2023 15:38
-
-
Save daiki1003/509a659037e5a7daefc4ab118aa40e88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OK | |
@Freezed(unionKey: 'type') | |
class FlightPlan with _$FlightPlan { | |
factory FlightPlan.first({ | |
required String type, | |
required String monitorMaker, | |
required bool baggageDeliveryAvailable, | |
}) = FirstClassFlightPlan; | |
factory FlightPlan.economy({ | |
required String type, | |
required String beefOrChicken, | |
}) = EconomyClassFlightPlan; | |
factory FlightPlan.fromJson(Map<String, dynamic> json) => | |
_$FlightPlanFromJson(json); | |
} | |
// NG | |
@Freezed(unionKey: 'plan_type') | |
class FlightPlan with _$FlightPlan { | |
factory FlightPlan.first({ | |
required String planType, | |
required String monitorMaker, | |
required bool baggageDeliveryAvailable, | |
}) = FirstClassFlightPlan; | |
factory FlightPlan.economy({ | |
required String planType, | |
required String beefOrChicken, | |
}) = EconomyClassFlightPlan; | |
factory FlightPlan.fromJson(Map<String, dynamic> json) => | |
_$FlightPlanFromJson(json); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment