checkAccess method
Checks whether access to gate is allowed under the current config.
Returns an AccessResult with the decision and reason.
Implementation
AccessResult checkAccess(FeatureGate gate) {
if (isEnabled(gate)) {
return AccessResult(
allowed: true,
reason: '${gate.name} is enabled for the ${_plan.name} plan.',
);
}
final upgradeUrl = _upgradeUrls[_plan];
return AccessResult(
allowed: false,
reason: '${gate.name} is not available on the ${_plan.name} plan.',
upgradeUrl: (upgradeUrl != null && upgradeUrl.isNotEmpty)
? upgradeUrl
: null,
);
}