changeSubscriptionPlan method

  1. @override
void changeSubscriptionPlan(
  1. String planId
)
override

Implementation

@override
void changeSubscriptionPlan(String planId) {
  AppConfig.logger.d("Changing Subscription Plan to: $planId");

  try {
    // Look up by map key first, then by plan.id field as fallback
    SubscriptionPlan? plan = _subscriptionPlans[planId];
    plan ??= _subscriptionPlans.values.where((p) => p.id == planId).firstOrNull;

    if(plan != null && plan.price != null) {
      _selectedPlan = plan;
      _selectedPlanName.value = selectedPlan.name;
      _selectedPlanImgUrl.value = selectedPlan.imgUrl;
      _selectedPrice.value = selectedPlan.price!;
    }
  } catch (e, st) {
    NeomErrorLogger.recordError(e, st, module: 'neom_core', operation: 'changeSubscriptionPlan');
  }

  update();
}