restorePurchases method

  1. @override
Future<bool> restorePurchases()
override

Restore all purchases

Implementation

@override
Future<bool> restorePurchases() async {
  logger.info('Start restore');

  try {
    final result = await Purchases.restorePurchases();

    _updateCustomerInfo(result);

    return subscriptionStatus.value;
  } on PlatformException catch (e) {
    logger.info('Restore purchase, platform exc $e');
    throwErrorOnPlatformException(e);
  } on Object catch (_) {
    logger.info('Failed to purchase product');
    throw const PurchaseFailedException(ErrorCode.unknown);
  }
}