entitlementInvalidationWatcherProvider top-level property
- @ProviderFor.new(entitlementInvalidationWatcher)
final
Background watcher that subscribes to Supabase Realtime on the
admin_grants and subscriptions tables and invalidates the cached
currentEntitlementsProvider on any change. RLS still filters which
rows the client receives — only grants/subs targeting the current user
(or their org, as an admin) will trigger an event.
The watcher is lifecycle-managed: it subscribes on the first read, tears down on provider dispose, and rebuilds when auth state changes so a sign-in/sign-out cleanly swaps the user context.
Wire into the app by reading the provider once at startup (e.g. from
main.dart's _initServicesAsync). Reading it is enough — the side
effect is the subscription.
Implementation
@ProviderFor(entitlementInvalidationWatcher)
final entitlementInvalidationWatcherProvider =
EntitlementInvalidationWatcherProvider._();