EntitlementDatasource class
Thin wrapper around the Postgres current_entitlements() RPC.
The RPC is SECURITY DEFINER, so it returns only the caller's own state. RLS policies and the ai-proxy Edge Function use the same function, making this the single source of truth for "what can this user do?".
Constructors
- EntitlementDatasource(SupabaseClient _client)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getCurrentEntitlements(
) → Future< EntitlementModel?> -
Fetch the caller's full entitlement state. Returns null on failure so the
provider can fall back to
Entitlement.none()without throwing. -
getOrgEntitlements(
String orgId) → Future< Map< String, dynamic> ?> - Fetch the entitlements for a specific organization — not the caller's user-level entitlements.
-
hasEntitlement(
String key) → Future< bool> - Server-side check for a single entitlement key. Cheaper than fetching the full entitlement set when you only need one boolean.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orgHasEntitlement(
String orgId, String key) → Future< bool> - Server-side check for a single entitlement key scoped to a specific org.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited