heroFallback function

ThemeSpec heroFallback(
  1. int seed,
  2. ThemeFamily family, {
  3. bool accessible = false,
})

The deterministic last-resort theme for (seed, family) when every generator attempt fails: one of the family's heroes (or any hero).

Implementation

ThemeSpec heroFallback(
  int seed,
  ThemeFamily family, {
  bool accessible = false,
}) {
  var pool = heroesFor(family);
  if (pool.isEmpty) pool = heroThemes;
  final hero = pool[(seed & 0xFFFFFFFF) % pool.length];
  return heroForAccessible(hero, accessible: accessible);
}