EntitlementResult class sealed

The result of an entitlement check for a named feature.

Use pattern-matching (switch / when) to handle all variants:

final result = await checker.check('export_pdf');
switch (result) {
  case EntitlementAllowed(:final productId):
    print('Access granted via $productId');
  case EntitlementDenied(:final reason):
    showPaywall(reason);
  case EntitlementLoading():
    showSpinner();
}
Implementers

Constructors

EntitlementResult.allowed({required String productId})
Access granted because productId is active.
factory
EntitlementResult.denied({required String reason})
Access denied for reason.
factory
EntitlementResult.loading()
The entitlement system has not yet completed initialisation.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isAllowed bool
Convenience: true only for EntitlementAllowed.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited