updateHasAcceptedMarketingOutreachApi function

Future<void> updateHasAcceptedMarketingOutreachApi({
  1. required BuildContext context,
  2. required bool hasAcceptedMarketingOutreach,
})

Implementation

Future<void> updateHasAcceptedMarketingOutreachApi({
  required BuildContext context,
  required bool hasAcceptedMarketingOutreach,
}) async {
  final container = ProviderScope.containerOf(context);

  final api = await container.read(energyManagementV3ApiProvider.future);

  final body = HomeownerUpdateV3Body(
    hasAcceptedMarketingOutreach: hasAcceptedMarketingOutreach,
  );

  final response = await api.kemApiV3HomeownerMePut(body: body);
  assertSuccessfulResponse(response);
  if (!context.mounted) return;
  await context.fullRefresh(homeownerApiProvider);
}