Fix Exception

type 'int' is not a subtype of type 'double?'
This commit is contained in:
NBA2K1 2025-07-12 04:28:33 +02:00
parent 47c9b79ce9
commit 1da0cdcdbf
6 changed files with 48 additions and 72 deletions

View file

@ -158,7 +158,7 @@ class _AddDownloadToQueueProviderElement
Chapter get chapter => (origin as AddDownloadToQueueProvider).chapter;
}
String _$downloadChapterHash() => r'e712508a81c414f66b12adeae23c3dc70380a920';
String _$downloadChapterHash() => r'914d4c0fda7d031878ef9c7ac0b3a44241558d5d';
/// See also [downloadChapter].
@ProviderFor(downloadChapter)

View file

@ -6,7 +6,7 @@ part of 'get_video_list.dart';
// RiverpodGenerator
// **************************************************************************
String _$getVideoListHash() => r'1d34225b32d5c0475f06c7066792837d4b800800';
String _$getVideoListHash() => r'74838334ee25412c4a3f151bc598705145bb659c';
/// Copied from Dart SDK
class _SystemHash {

View file

@ -6,7 +6,7 @@ part of 'anilist.dart';
// RiverpodGenerator
// **************************************************************************
String _$anilistHash() => r'8cd0495c613bbb8c86a61e990f1755b58b983d79';
String _$anilistHash() => r'c786a526fdacc875e4a7e00886b2bda546eafeae';
/// Copied from Dart SDK
class _SystemHash {

View file

@ -6,7 +6,7 @@ part of 'kitsu.dart';
// RiverpodGenerator
// **************************************************************************
String _$kitsuHash() => r'970f2e278a3f0163da30684e030c3a7833bf9ae2';
String _$kitsuHash() => r'e24e9b57cfea974110d1f7c704c306c3b58e3529';
/// Copied from Dart SDK
class _SystemHash {

View file

@ -146,7 +146,7 @@ class MyAnimeList extends _$MyAnimeList {
publishingType: res["media_type"].toString().replaceAll("_", " "),
publishingStatus: res["status"].toString().replaceAll("_", " "),
trackingUrl: "https://myanimelist.net/$item/${res["id"]}",
score: res["mean"],
score: (res["mean"] as num?)?.toDouble(),
syncId: syncId,
);
}
@ -171,32 +171,23 @@ class MyAnimeList extends _$MyAnimeList {
return res['data'] == null
? []
: (res['data'] as List)
.map(
(e) => TrackSearch(
mediaId: e["node"]["id"],
summary: e["node"]["synopsis"] ?? "",
totalChapter: e["node"][contentUnit],
coverUrl: e["node"]["main_picture"]["large"] ?? "",
title: e["node"]["title"],
score: e["node"]["mean"] is double
? e["node"]["mean"]
: ((e["node"]["mean"] ?? 0) as int).toDouble(),
startDate: e["node"]["start_date"] ?? "",
publishingType: e["node"]["media_type"].toString().replaceAll(
"_",
" ",
),
publishingStatus: e["node"]["status"].toString().replaceAll(
"_",
" ",
),
trackingUrl:
"https://myanimelist.net/$item/${e["node"]["id"]}",
syncId: syncId,
),
)
.toList();
: (res['data'] as List).map((e) {
final node = e["node"] as Map<String, dynamic>;
String clean(String? s) => (s ?? '').replaceAll('_', ' ');
return TrackSearch(
mediaId: node["id"],
summary: node["synopsis"] ?? "",
totalChapter: node[contentUnit],
coverUrl: node["main_picture"]["large"] ?? "",
title: node["title"],
score: (node["mean"] as num?)?.toDouble(),
startDate: node["start_date"] ?? "",
publishingType: clean(node["media_type"].toString()),
publishingStatus: clean(node["status"].toString()),
trackingUrl: "https://myanimelist.net/$item/${node["id"]}",
syncId: syncId,
);
}).toList();
}
Future<List<TrackSearch>> fetchUserData({bool isManga = true}) async {
@ -219,46 +210,31 @@ class MyAnimeList extends _$MyAnimeList {
return res['data'] == null
? []
: (res['data'] as List)
.map(
(e) => TrackSearch(
mediaId: e["node"]["id"],
summary: e["node"]["synopsis"] ?? "",
totalChapter: e["node"][contentUnit],
coverUrl: e["node"]["main_picture"]["large"] ?? "",
title: e["node"]["title"],
score: e["node"]["mean"] is double
? e["node"]["mean"]
: ((e["node"]["mean"] ?? 0) as int).toDouble(),
startDate: e["node"]["start_date"] ?? "",
publishingType: e["node"]["media_type"].toString().replaceAll(
"_",
" ",
),
publishingStatus: e["node"]["status"].toString().replaceAll(
"_",
" ",
),
trackingUrl:
"https://myanimelist.net/$item/${e["node"]["id"]}",
startedReadingDate: _parseDate(
e["list_status"]["start_date"],
),
finishedReadingDate: _parseDate(
e["list_status"]["finish_date"],
),
lastChapterRead:
e["list_status"][isManga
? "num_chapters_read"
: "num_episodes_watched"],
status: fromMyAnimeListStatus(
e["list_status"]["status"],
isManga,
).name,
syncId: syncId,
),
)
.toList();
: (res['data'] as List).map((e) {
final node = e["node"] as Map<String, dynamic>;
final listStatus = e["list_status"] as Map<String, dynamic>;
String clean(String? s) => (s ?? '').replaceAll('_', ' ');
return TrackSearch(
mediaId: node["id"],
summary: node["synopsis"] ?? "",
totalChapter: node[contentUnit],
coverUrl: node["main_picture"]["large"] ?? "",
title: node["title"],
score: (node["mean"] as num?)?.toDouble(),
startDate: node["start_date"] ?? "",
publishingType: clean(node["media_type"].toString()),
publishingStatus: clean(node["status"].toString()),
trackingUrl: "https://myanimelist.net/$item/${node["id"]}",
startedReadingDate: _parseDate(listStatus["start_date"]),
finishedReadingDate: _parseDate(listStatus["finish_date"]),
lastChapterRead:
listStatus[isManga
? "num_chapters_read"
: "num_episodes_watched"],
status: fromMyAnimeListStatus(listStatus["status"], isManga).name,
syncId: syncId,
);
}).toList();
}
String _convertToIsoDate(int? epochTime) {

View file

@ -6,7 +6,7 @@ part of 'myanimelist.dart';
// RiverpodGenerator
// **************************************************************************
String _$myAnimeListHash() => r'98746d3f3ac88a6165b46de18acb268dc32a16f8';
String _$myAnimeListHash() => r'a612e9ce814268ac79dc86d810ca6bd3671812e6';
/// Copied from Dart SDK
class _SystemHash {