summaryrefslogtreecommitdiff
path: root/server/lib/core/models/monster_ability.dart
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-23 18:55:57 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-23 18:55:57 +0100
commit6060c43bee23ebae41edbe914ba991ebf0a96924 (patch)
treea7057786b91e25048eb1eb47f960dcb33ecbbbc1 /server/lib/core/models/monster_ability.dart
parent7ee14396b1f1f96ed0472b5949ce82a7f9313276 (diff)
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<List<Object?>> (and the graphic extras to Map entries), the summon payload to Map<String, dynamic>, room data lists/maps explicitly, and deck card lists to Map<String, dynamic> 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.
Diffstat (limited to 'server/lib/core/models/monster_ability.dart')
-rw-r--r--server/lib/core/models/monster_ability.dart12
1 files changed, 4 insertions, 8 deletions
diff --git a/server/lib/core/models/monster_ability.dart b/server/lib/core/models/monster_ability.dart
index f13ee3e..0ced186 100644
--- a/server/lib/core/models/monster_ability.dart
+++ b/server/lib/core/models/monster_ability.dart
@@ -12,11 +12,8 @@ class MonsterAbilityDeckModel {
String edition,
) {
final name = data['name'] as String;
- final List<dynamic> dynamicCards =
- data['cards']
- as List<
- dynamic
- >; // ignore: avoid-dynamic, complex JSON cards array requires mutable dynamic list
+ final List<List<Object?>> dynamicCards =
+ (data['cards'] as List).cast<List<Object?>>();
final List<MonsterAbilityCardModel> cards = [];
for (final card in dynamicCards) {
String title = name;
@@ -35,10 +32,9 @@ class MonsterAbilityDeckModel {
final List<GraphicPositional> graphicPositionals = [];
if (card[3] is List) {
//handle the graphic extras
- final List<dynamic> list =
- card[3]; // ignore: avoid-dynamic, graphic extras are a dynamic JSON array
+ final List<dynamic> list = card[3] as List;
- for (final item in list) {
+ for (final Map<String, dynamic> item in list) {
double angle = 0;
double scale = 1;
if (item.containsKey('angle')) {