fix(shorebird_code_push_protocol): make current period start/end nonnull (#2430)

This commit is contained in:
Bryan Oltman
2024-08-19 17:37:17 -04:00
committed by GitHub
parent 58717b3aad
commit 5620b3445e
2 changed files with 11 additions and 10 deletions
@@ -51,12 +51,13 @@ class Plan {
final Decimal? pricePerOverageInstall;
/// The start of the current billing period.
/// This will be null for accounts without a subscription.
final DateTime? currentPeriodStart;
/// If the user is on a free plan, this will be the start of the current
/// month.
final DateTime currentPeriodStart;
/// The end of the current billing period.
/// This will be null for accounts without a subscription.
final DateTime? currentPeriodEnd;
/// If the user is on a free plan, this will be the start of the next month.
final DateTime currentPeriodEnd;
/// Whether the subscription will be canceled at the end of the current
/// billing period.
@@ -18,10 +18,10 @@ Plan _$PlanFromJson(Map<String, dynamic> json) => $checkedCreate(
basePrice: $checkedConvert('base_price', (v) => (v as num).toInt()),
baseInstallCount:
$checkedConvert('base_install_count', (v) => (v as num).toInt()),
currentPeriodStart: $checkedConvert('current_period_start',
(v) => v == null ? null : DateTime.parse(v as String)),
currentPeriodEnd: $checkedConvert('current_period_end',
(v) => v == null ? null : DateTime.parse(v as String)),
currentPeriodStart: $checkedConvert(
'current_period_start', (v) => DateTime.parse(v as String)),
currentPeriodEnd: $checkedConvert(
'current_period_end', (v) => DateTime.parse(v as String)),
cancelAtPeriodEnd:
$checkedConvert('cancel_at_period_end', (v) => v as bool),
isTiered: $checkedConvert('is_tiered', (v) => v as bool),
@@ -50,8 +50,8 @@ Map<String, dynamic> _$PlanToJson(Plan instance) => <String, dynamic>{
'base_price': instance.basePrice,
'base_install_count': instance.baseInstallCount,
'price_per_overage_install': instance.pricePerOverageInstall?.toJson(),
'current_period_start': instance.currentPeriodStart?.toIso8601String(),
'current_period_end': instance.currentPeriodEnd?.toIso8601String(),
'current_period_start': instance.currentPeriodStart.toIso8601String(),
'current_period_end': instance.currentPeriodEnd.toIso8601String(),
'cancel_at_period_end': instance.cancelAtPeriodEnd,
'is_tiered': instance.isTiered,
'max_team_size': instance.maxTeamSize,