summaryrefslogtreecommitdiff
path: root/server/lib/core/state/game_save_state.dart
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-23 15:38:13 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-23 15:38:13 +0100
commit7ee14396b1f1f96ed0472b5949ce82a7f9313276 (patch)
treecddf00fe4049908155a15e813bb8d226ad710f81 /server/lib/core/state/game_save_state.dart
parent4a45fe143bd050d89183427443dedfd656f507bc (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/state/game_save_state.dart')
-rw-r--r--server/lib/core/state/game_save_state.dart18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/core/state/game_save_state.dart b/server/lib/core/state/game_save_state.dart
index 331b3a8..57ddf30 100644
--- a/server/lib/core/state/game_save_state.dart
+++ b/server/lib/core/state/game_save_state.dart
@@ -27,7 +27,7 @@ class GameSaveState {
}
if (data.containsKey('scenarioSectionsAdded')) {
- List<Object?> scenarioSectionsAdded =
+ final List<Object?> scenarioSectionsAdded =
data['scenarioSectionsAdded'] as List<Object?>;
gameState._scenarioSectionsAdded.clear();
for (final item in scenarioSectionsAdded) {
@@ -78,7 +78,7 @@ class GameSaveState {
//main list — update existing objects in-place
final list = data['currentList'] as List;
- List<ListItemData> newList = [];
+ final List<ListItemData> newList = [];
for (Map<String, dynamic> item in list) {
if (item["noteRow"] == true) {
final String itemId = item["id"] as String;
@@ -133,10 +133,10 @@ class GameSaveState {
// Prototype has the full initialized card set; used only for nr lookups.
final proto = MonsterAbilityState(deckName);
- List<MonsterAbilityCardModel> newDrawList = [];
- List drawPile = item["drawPile"] as List;
+ final List<MonsterAbilityCardModel> newDrawList = [];
+ final List drawPile = item["drawPile"] as List;
for (final cardItem in drawPile) {
- int nr = cardItem["nr"];
+ final int nr = cardItem["nr"];
for (final card in proto._drawPile.getList()) {
if (card.nr == nr) {
newDrawList.add(card);
@@ -144,9 +144,9 @@ class GameSaveState {
}
}
}
- List<MonsterAbilityCardModel> newDiscardList = [];
+ final List<MonsterAbilityCardModel> newDiscardList = [];
for (final cardItem in item["discardPile"] as List) {
- int nr = cardItem["nr"];
+ final int nr = cardItem["nr"];
for (final card in proto._drawPile.getList()) {
if (card.nr == nr) {
newDiscardList.add(card);
@@ -192,7 +192,7 @@ class GameSaveState {
}
//////elements
- Map elementData = data['elementState'];
+ final Map elementData = data['elementState'];
for (final element in Elements.values) {
final raw = elementData[element.index.toString()] as int?;
final idx =
@@ -218,7 +218,7 @@ class GameSaveState {
void loadFromDisk(GameState gameState) {
//have to call after init or element state overridden
- String? data = getIt<SaveStore>().read();
+ final String? data = getIt<SaveStore>().read();
if (data != null) {
_savedState = data;
load(gameState);