check method

bool check(
  1. String featureName,
  2. bool condition,
  3. MorphPlan requiredPlan
)

Returns condition and, when blocked in debug builds, prints a pointer to the upgrade URL. Used internally by the check… shortcuts below. Production builds never log (the assert closure is stripped).

Implementation

bool check(
  String featureName,
  bool condition,
  MorphPlan requiredPlan,
) {
  if (condition) return true;
  assert(() {
    debugPrint(
      '🦎 Morph: "$featureName" requires '
      '${requiredPlan.label} plan. Current plan: ${plan.label}. '
      'Upgrade at ${MorphPlan.upgradeUrl}',
    );
    return true;
  }());
  return false;
}