From f88978219f685d32c00132813db5c739102f44fc Mon Sep 17 00:00:00 2001 From: NBA2K1 <78034913+NBA2K1@users.noreply.github.com> Date: Sun, 17 Aug 2025 20:21:28 +0200 Subject: [PATCH 1/2] Fix Kitsu "No Cover" Exception ``` NoSuchMethodError: The method '[]' was called on null. Receiver: null Tried calling []("original") ``` --- lib/services/trackers/kitsu.dart | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/services/trackers/kitsu.dart b/lib/services/trackers/kitsu.dart index 91aca50d..384c32c1 100644 --- a/lib/services/trackers/kitsu.dart +++ b/lib/services/trackers/kitsu.dart @@ -160,7 +160,7 @@ class Kitsu extends _$Kitsu { mediaId: jsonRes['id'], summary: jsonRes['synopsis'] ?? "", totalChapter: (jsonRes[totalChapter] ?? 0), - coverUrl: jsonRes['posterImage']['original'] ?? "", + coverUrl: jsonRes['posterImage']?['original'] ?? "", title: jsonRes['canonicalTitle'], startDate: "", publishingType: (jsonRes["subtype"] ?? ""), @@ -192,22 +192,23 @@ class Kitsu extends _$Kitsu { final mediaId = jsonRes['id'] is String ? int.parse(jsonRes['id']) : jsonRes['id']; - final score = jsonRes['attributes']['averageRating'] is String - ? double.parse(jsonRes['attributes']['averageRating']) - : jsonRes['attributes']['averageRating']; + final attributes = jsonRes['attributes']; + final score = attributes['averageRating'] is String + ? double.parse(attributes['averageRating']) + : attributes['averageRating']; return TrackSearch( libraryId: mediaId, syncId: syncId, trackingUrl: _mediaUrl(isManga ? 'manga' : 'anime', mediaId), mediaId: mediaId, - summary: jsonRes['attributes']['synopsis'] ?? "", - totalChapter: (jsonRes['attributes'][totalChapter] ?? 0), - coverUrl: jsonRes['attributes']['posterImage']['original'] ?? "", - title: jsonRes['attributes']['canonicalTitle'], + summary: attributes['synopsis'] ?? "", + totalChapter: (attributes[totalChapter] ?? 0), + coverUrl: attributes['posterImage']?['original'] ?? "", + title: attributes['canonicalTitle'], startDate: "", score: score, - publishingType: (jsonRes['attributes']['subtype'] ?? ""), - publishingStatus: jsonRes['attributes']['endDate'] == null + publishingType: (attributes['subtype'] ?? ""), + publishingStatus: attributes['endDate'] == null ? "Publishing" : "Finished", ); @@ -250,7 +251,7 @@ class Kitsu extends _$Kitsu { trackingUrl: _mediaUrl(type, id), summary: included['synopsis'] ?? "", totalChapter: included[totalChapter] ?? 0, - coverUrl: included['posterImage']['original'] ?? "", + coverUrl: included['posterImage']?['original'] ?? "", title: included['canonicalTitle'], startDate: "", publishingType: (included["subtype"] ?? ""), From 85751538ac60e90c91b418c000e0aad85097cefd Mon Sep 17 00:00:00 2001 From: NBA2K1 <78034913+NBA2K1@users.noreply.github.com> Date: Sun, 17 Aug 2025 20:55:15 +0200 Subject: [PATCH 2/2] Fix MAL "No Cover" Exception ``` NoSuchMethodError: The method '[]' was called on null. Receiver: null Tried calling []("large") ``` --- lib/services/trackers/myanimelist.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/services/trackers/myanimelist.dart b/lib/services/trackers/myanimelist.dart index 376c0fcf..eb7c9a8b 100644 --- a/lib/services/trackers/myanimelist.dart +++ b/lib/services/trackers/myanimelist.dart @@ -159,7 +159,7 @@ class MyAnimeList extends _$MyAnimeList { mediaId: res["id"], summary: res["synopsis"] ?? "", totalChapter: res[contentUnit], - coverUrl: res["main_picture"]["large"] ?? "", + coverUrl: res["main_picture"]?["large"] ?? "", title: res["title"], startDate: res["start_date"] ?? "", publishingType: res["media_type"].toString().replaceAll("_", " "), @@ -197,7 +197,7 @@ class MyAnimeList extends _$MyAnimeList { mediaId: node["id"], summary: node["synopsis"] ?? "", totalChapter: node[contentUnit], - coverUrl: node["main_picture"]["large"] ?? "", + coverUrl: node["main_picture"]?["large"] ?? "", title: node["title"], score: (node["mean"] as num?)?.toDouble(), startDate: node["start_date"] ?? "", @@ -237,7 +237,7 @@ class MyAnimeList extends _$MyAnimeList { mediaId: node["id"], summary: node["synopsis"] ?? "", totalChapter: node[contentUnit], - coverUrl: node["main_picture"]["large"] ?? "", + coverUrl: node["main_picture"]?["large"] ?? "", title: node["title"], score: (node["mean"] as num?)?.toDouble(), startDate: node["start_date"] ?? "",