FeatureGateService class

Service for managing feature gate state and access control.

Gates can be loaded from a remote API endpoint, read from a local config file, or evaluated based on the current plan tier. Local overrides take precedence over plan defaults.

Constructors

FeatureGateService({Plan plan = Plan.free, String? configPath, String? organizationId})
Creates a new feature gate service.

Properties

hashCode int
The hash code for this object.
no setterinherited
onGateChanged Stream<(FeatureGate, bool)>
Stream of gate change events as (gate, newValue) tuples.
no setter
organizationId String?
The current organization identifier.
no setter
plan Plan
The current plan tier.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkAccess(FeatureGate gate) AccessResult
Checks whether access to gate is allowed under the current config.
disableGate(FeatureGate gate) → void
Disables gate as a local override.
dispose() → void
Disposes the service and closes the change stream.
enableGate(FeatureGate gate) → void
Enables gate as a local override.
evaluateForPlan(Plan plan) FeatureGateConfig
Evaluates which gates should be enabled for plan and returns a FeatureGateConfig snapshot.
getEnabledGates() Set<FeatureGate>
Returns the set of all currently enabled gates.
isEnabled(FeatureGate gate) bool
Returns whether gate is currently enabled.
loadFromLocal() Future<FeatureGateConfig>
Loads gate overrides from the local config file.
loadFromRemote(String endpoint) Future<FeatureGateConfig>
Loads gate configuration from a remote endpoint via HTTP GET.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requireGate(FeatureGate gate, {String? message}) → void
Throws a FeatureGateException if gate is not enabled.
saveToLocal() Future<void>
Persists the current gate overrides to the local config file.
toString() String
A string representation of this object.
inherited

Operators

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