File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,23 +23,19 @@ class SubscriptionExpanded {
2323 ) {
2424 List <Discount >? discounts;
2525 if (expand.contains (SubscriptionExpandableField .discounts)) {
26- discounts = DiscountsExpandableField ().extract (json);
26+ discounts = const DiscountsExpandableField ().extract (json);
2727 }
2828
2929 InvoiceExpanded ? latestInvoice;
3030 if (expand.contains (SubscriptionExpandableField .latestInvoice)) {
31- latestInvoice = LatestInvoiceExpandedExpandableField (
31+ latestInvoice = const LatestInvoiceExpandedExpandableField (
3232 expand: {InvoiceExpandableField .paymentIntent},
3333 ).extract (json);
3434 }
3535
3636 Customer ? customer;
3737 if (expand.contains (SubscriptionExpandableField .customer)) {
38- const customerExpander = CustomerExpandableField ();
39- customer = customerExpander.extract (json);
40-
41- /// A shim so that Subscription gets parsed correctly
42- json[customerExpander.field] = customer.id;
38+ customer = const CustomerExpandableField ().extract (json);
4339 }
4440
4541 return SubscriptionExpanded (
Original file line number Diff line number Diff line change 11import 'package:stripe/messages.dart' ;
2- import 'package:stripe/src/utils/expandable_field .dart' ;
2+ import 'package:stripe/src/utils/expandable_object_field .dart' ;
33
4- class CustomerExpandableField extends ExpandableField <Customer > {
4+ class CustomerExpandableField extends ExpandableObjectField <Customer > {
55 @override
66 String get field => 'customer' ;
77
88 const CustomerExpandableField ();
99
1010 @override
11- Customer extract (Map <String , dynamic > json) => Customer .fromJson (json[field]);
11+ Customer parse (Map <String , dynamic > object) =>
12+ Customer .fromJson (object[field]);
13+
14+ @override
15+ String replacement (Customer parsedValue) => parsedValue.id;
1216}
You can’t perform that action at this time.
0 commit comments