diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-11-23 15:38:13 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-11-23 15:38:13 +0100 |
| commit | 7ee14396b1f1f96ed0472b5949ce82a7f9313276 (patch) | |
| tree | cddf00fe4049908155a15e813bb8d226ad710f81 /server/lib/core/methods/scenario_methods.dart | |
| parent | 4a45fe143bd050d89183427443dedfd656f507bc (diff) | |
server: make local variables final (prefer_final_locals)
270 locals across 52 files. Six of them were declared with an
unnecessarily nullable type (ModifierDeck? / LootDeckModel?) although
the initializer is non-nullable; non-final locals were silently
flow-promoted to the initializer's type, but final locals are not, so
the nullability is dropped where it was wrong.
Diffstat (limited to 'server/lib/core/methods/scenario_methods.dart')
| -rw-r--r-- | server/lib/core/methods/scenario_methods.dart | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/lib/core/methods/scenario_methods.dart b/server/lib/core/methods/scenario_methods.dart index 257d076..a75fc80 100644 --- a/server/lib/core/methods/scenario_methods.dart +++ b/server/lib/core/methods/scenario_methods.dart @@ -107,7 +107,7 @@ class ScenarioMethods { gs._scenario = scenario; gs._scenarioSectionsAdded = []; - List<ListItemData> newList = []; + final List<ListItemData> newList = []; for (final item in gs.currentList) { if (item is Character) { if (!GameMethods.isObjectiveOrEscort(item.characterClass)) { @@ -127,14 +127,14 @@ class ScenarioMethods { static void _initLootDeck(String scenario, GameState gs, GameData gd) { if (scenario != "custom") { final campaignModel = gd.modelData[gs.currentCampaign]; - LootDeckModel? lootDeckModel = + final LootDeckModel? lootDeckModel = campaignModel?.scenarios[scenario]?.lootDeck; lootDeckModel != null ? gs._lootDeck = LootDeck(lootDeckModel, gs.lootDeck) : gs._lootDeck = LootDeck.from(gs.lootDeck); } else { if (gs.currentCampaign == "Frosthaven") { - LootDeckModel? lootDeckModel = const LootDeckModel( + final LootDeckModel lootDeckModel = const LootDeckModel( 2, 2, 2, @@ -171,7 +171,7 @@ class ScenarioMethods { List<String> monsters = []; List<SpecialRule> specialRules = []; List<RoomMonsterData> roomMonsterData = []; - List<String> subSections = []; + final List<String> subSections = []; String initMessage = ""; if (section) { @@ -256,7 +256,7 @@ class ScenarioMethods { if (item.type == "Objective") { if (item.condition == "" || StatCalculator.evaluateCondition(item.condition as Object)) { - Character? objective = CharacterMethods.createCharacter( + final Character? objective = CharacterMethods.createCharacter( s, "Objective", null, |
