planIapSlate function

SlatePlan? planIapSlate({
  1. required String service,
  2. required Prompt prompt,
})

Builds the slate plan for an iap invocation. Mirrors planAuthSlate in shape; for RevenueCat the user can type n to skip a platform key, which is normalised to the empty string (the stub treats '' as "leave the configure line commented out with placeholder text").

Implementation

SlatePlan? planIapSlate({
  required String service,
  required Prompt prompt,
}) {
  switch (service) {
    case 'RevenueCat':
      var apple = prompt(appleRevenueCatKeyPrompt);
      if (apple == 'n') apple = '';
      var android = prompt(androidRevenueCatKeyPrompt);
      if (android == 'n') android = '';
      final config = NyRevenueCatSlateConfig(
        appleAppId: apple,
        androidAppId: android,
      );
      return SlatePlan(
        packagesToAdd: const ['purchases_flutter', 'purchases_ui_flutter'],
        templates: revenueCatRun(config),
        config: config,
      );
    default:
      return null;
  }
}