0

I am not able to fetch the products from revenuecat. the issue is that when i try to fetch the products, i get an empty array.

there are products as show in pictures, what am i doing wrong?

here is the main code::

Future<void> main() async {
   await dotenv.load();

  WidgetsFlutterBinding.ensureInitialized();

 
  RevenueCat.init();

  await Firebase.initializeApp(
    name: "thraive-5f2ab",
    options: DefaultFirebaseOptions.currentPlatform,
  );

here is the class that I am using::

import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:purchases_flutter/models/offerings_wrapper.dart';
import 'package:purchases_flutter/purchases_flutter.dart';

class RevenueCat {
  static final _apiKey = dotenv.env['REVENUE_CAT_API_KEY']!;

  static Future init() async {
    // await Purchases.setDebugLogsEnabled(true);
    // await Purchases.setup(_apiKey);
    final revenueCat =
        PurchasesConfiguration(dotenv.env['REVENUE_CAT_API_KEY']!);
    await Purchases.configure(revenueCat);
  }

  static Future<List<Offering>> fetchOffers() async {
    try {
      final offerings = await Purchases.getOfferings();
      final current = offerings.current;
      return current == null ? [] : [current];
    } catch (e) {
      return [];
    }
  }
}

here is the revenue dashboard:: revenuecat dashboard

here is the apple app:: apple app

here is the entitlement dash:: entitlements

entitlement used

here are the products:: products

product used:: product used

identifier used::

identifier

offerings used::

offerings

Juan Casas
  • 268
  • 2
  • 13

0 Answers0