Search code examples
flutterflutter-dependencies

Flutter Undefined class 'PurchaserInfo'


I have a flutter project which was working fine since yesterday. Today I am seeing class not found error for couple of packages even though the packages are imported.

Error: Undefined class 'PurchaserInfo'.

Code:

import 'package:purchases_flutter/purchases_flutter.dart';

PurchaserInfo purchaserInfo = await Purchases.purchasePackage(_package);

pubspec.yaml

environment:
sdk: ">=2.7.0 < 3.0.0"

purchases_flutter: ^4.3.1

IDE: VSCode or Android Studio

I also checked RevenueCat's documentation and they I do not see any error.

I tried flutter clean and flutter pub get.

Please see the following image of the issue. enter image description here


Solution

  • I also get that error in latest version of reveneucat. Change PurchaserInfo to CustomerInfo then the problem will be resolved. some example code here:

    CustomerInfo purchaserInfo = await Purchases.purchasePackage(
            myProductList.firstWhere(
                (element) => element.offeringIdentifier == productIdentify),
          )