currentLevel static method
Resolves the current user's SubscriptionLevel safely.
Falls back to SubscriptionLevel.freemium in any of these cases: • UserController is not yet registered (startup, splash). • Tests run without a fake user controller. • Guest mode before login. • Any transient error reading the level.
Implementation
static SubscriptionLevel currentLevel() {
if (!Sint.isRegistered<UserController>()) {
return SubscriptionLevel.freemium;
}
try {
return Sint.find<UserController>().subscriptionLevel;
} catch (_) {
return SubscriptionLevel.freemium;
}
}