modifySubscription method

Future<void> modifySubscription({
  1. String? orgId,
  2. required String priceId,
})

Modifies the subscription asynchronously Sets loading state and invokes the provider method

Implementation

Future<void> modifySubscription({
  String? orgId,
  required String priceId,
}) async {
  emit(state.startLoading(BillingLoadingStates.modifySubscription));

  try {
    return await provider.modifySubscription(
      orgId: orgId,
      priceId: priceId,
    );
  } catch (error, stackTrace) {
    emit(state.addMessage(
      Message.error(_localizations.unknownError),
      error,
      stackTrace,
    ));
    rethrow;
  } finally {
    emit(state.endLoading(BillingLoadingStates.modifySubscription));
  }
}