of static method

PluginBudget? of(
  1. PluginManifest manifest
)

The budget manifest declares, or null when it declares none or one that does not read — the manifest check says which, in a sentence.

Implementation

static PluginBudget? of(PluginManifest manifest) {
  if (budgetProblemOf(manifest) != null) return null;
  final raw = manifest.extra['budget'];
  if (raw is! Map) return null;
  return PluginBudget(
    stepLimit: switch (raw['stepMicroseconds']) {
      final int micros => Duration(microseconds: micros),
      _ => null,
    },
    eventsPerStep: raw['eventsPerStep'] as int?,
  );
}