From 6060c43bee23ebae41edbe914ba991ebf0a96924 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 23 Nov 2026 18:55:57 +0100 Subject: server: type the JSON parsing boundaries (avoid_dynamic_calls) Give the decoded JSON values a static type before use: cast the monster-ability card list to List> (and the graphic extras to Map entries), the summon payload to Map, room data lists/maps explicitly, and deck card lists to Map loop variables. The test assertions on the settings payload get the same treatment. Also drops two stale ignore comments (wrong lint code) and a redundant nested assignment. --- server/lib/core/models/room.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/lib/core/models/room.dart') diff --git a/server/lib/core/models/room.dart b/server/lib/core/models/room.dart index 036a385..56a86ef 100644 --- a/server/lib/core/models/room.dart +++ b/server/lib/core/models/room.dart @@ -8,10 +8,10 @@ class RoomMonsterData { factory RoomMonsterData.fromJson(Map data, String key) { final String name = key; final List normal = data.containsKey('normal') - ? data['normal'].cast() + ? (data['normal'] as List).cast() : [0, 0, 0]; final List elite = data.containsKey('elite') - ? data['elite'].cast() + ? (data['elite'] as List).cast() : [0, 0, 0]; return RoomMonsterData(name, normal, elite); @@ -26,7 +26,7 @@ class RoomModel { factory RoomModel.fromJson(Map data) { final String name = data.keys.first; final List monsterList = []; - data[name].forEach((key, value) { + (data[name] as Map).forEach((key, value) { monsterList.add(RoomMonsterData.fromJson(value, key)); }); -- cgit v1.3.1