Skip to main content
Question

Question about Real-time Subscription Status Updates in Flutter

  • December 8, 2024
  • 2 replies
  • 39 views

Forum|alt.badge.img+7
I've implemented a listener for subscription status changes in my Flutter app like this:

 

void listenToCustomerInfoUpdates(Function(CustomerInfo) listener) {
  Purchases.addCustomerInfoUpdateListener((customerInfo) {
    // Called whenever subscription status changes
    listener(customerInfo);
  });
}
I want to confirm: If a user cancels their subscription through the system subscription settings (App Store), will this listener automatically detect the change?
My implementation:
  • I've set up the listener in my service layer
  • Using it with BLoC pattern to update UI state
  • The listener is registered when the app initializes
Is this the correct approach for handling real-time subscription status updates? Will it catch all subscription state changes including cancellations through the system settings?
Thanks in advance for any clarification!
This post has been closed for comments

2 replies

jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 270 replies
  • December 11, 2024

Hi ​@Jonghwan! The listener updates when the SDK fetches customerInfo. This happens when the SDK is configured, purchases are made or restored, and periodically throughout the lifecycle of your app. Our cache policy for customerInfo is available here, and it’s important to note that the listener only updates when a change in CustomerInfo is received on the current device - this is relevant to you if you’re also building your Flutter app for Android and your customers use both platforms.

To sum - the listener won’t immediately be triggered by system settings changes, but, depending on the current cache and behavior of your app, it should be updated relatively quickly.

Also, I wanted to point out the invalidateCustomerInfoCache method. In certain scenarios when you need the most up-to-date customerInfo and can’t wait for the cache to expire, you can use this method.


Forum|alt.badge.img+7
  • Author
  • Active Member
  • 14 replies
  • December 16, 2024

Thank you so much!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings