From 7ee14396b1f1f96ed0472b5949ce82a7f9313276 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 23 Nov 2026 15:38:13 +0100 Subject: 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. --- server/lib/core/methods/scenario_methods.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server/lib/core/methods/scenario_methods.dart') 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 newList = []; + final List 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 monsters = []; List specialRules = []; List roomMonsterData = []; - List subSections = []; + final List 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, -- cgit v1.3.1