Question

@OptIn(ExperimentalPreviewRevenueCatUIPurchasesAPI::class) for flutter

  • 2 June 2024
  • 1 reply
  • 36 views

Badge

So , I've been trying to get the paywall_ui working in my Flutter project. 

Using:

purchases_flutter: ^6.29.2

purchases_ui_flutter: ^7.0.0-beta.1

I’m able to show a paywall perfectly fine. So, after the set-up, I was hoping to use PaywallVIew to call some methods based on events. But the specified options, like “onPurchaseCompleted,” didn’t exist for this version of the plugin, which seems odd. 

In an attempt to resolve the issue, I reverted to purchases_ui_flutter: ^6.29.2, which does include the options I needed in PaywallView.

Now the problem is that while trying to build the project I get this error and the build fails.

e: file:///Users/apple/.pub-cache/hosted/pub.dev/purchases_ui_flutter-6.29.2/android/src/main/kotlin/com/revenuecat/purchases_ui_flutter/PurchasesUiFlutterPlugin.kt:96:16 This declaration needs opt-in. Its usage must be marked with '@com.revenuecat.purchases.ui.revenuecatui.ExperimentalPreviewRevenueCatUIPurchasesAPI' or '@OptIn(com.revenuecat.purchases.ui.revenuecatui.ExperimentalPreviewRevenueCatUIPurchasesAPI::class)'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':purchases_ui_flutter:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction

 

Looking online and looking into the flutter section of the RevenueCat docs i couldn’t find any solutions.
the android section does show how to optin but this method does not work in Flutter.

is there a change that i can make to my build.gradle files or some other opin method for Flutter?

 


This post has been closed for comments

1 reply

Badge

Is there a way to edit the PaywallView section of my project in the purchases_ui_flutter: ^7.0.0-beta1, to include the options to handle certain events?