Skip to content

Commit

Permalink
refactor: following dart best practices
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYuuki committed Dec 2, 2024
1 parent 01fcd12 commit f6aa5f6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class _HomePageState extends State<HomePage> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AnimeList(),
builder: (context) => const AnimeList(),
),
);
Provider.of<AniListProvider>(context, listen: false)
Expand All @@ -346,7 +346,7 @@ class _HomePageState extends State<HomePage> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AnilistMangaList(),
builder: (context) => const AnilistMangaList(),
),
);
Provider.of<AniListProvider>(context, listen: false)
Expand All @@ -370,7 +370,7 @@ class _HomePageState extends State<HomePage> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AnimeList(),
builder: (context) => const AnimeList(),
),
);
Provider.of<AniListProvider>(context, listen: false)
Expand All @@ -387,7 +387,7 @@ class _HomePageState extends State<HomePage> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AnilistMangaList(),
builder: (context) => const AnilistMangaList(),
),
);
Provider.of<AniListProvider>(context, listen: false)
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/apiHooks/anilist/anime/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Future<List<Map<String, dynamic>>> fetchAnimeBySearch({
query (\$search: String, \$sort: [MediaSort], \$season: MediaSeason, \$status: MediaStatus, \$format: MediaFormat, \$genre_in: [String]) {
Page (page: 1) {
media (
${query != null && query.isNotEmpty ? 'search: \$search,' : ''}
${query.isNotEmpty ? 'search: \$search,' : ''}
type: ANIME,
sort: \$sort,
season: \$season,
Expand Down
9 changes: 5 additions & 4 deletions lib/utils/sources/anime/extractors/vidstream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Vidstream {

final res = (await get(
Uri.parse(
"${epLink.scheme}://${epLink.host}/encrypt-ajax.php?${params}"),
"${epLink.scheme}://${epLink.host}/encrypt-ajax.php?$params"),
headers: {
'X-Requested-With': 'XMLHttpRequest',
}));
Expand All @@ -40,8 +40,9 @@ class Vidstream {

dynamic qualityList = [];

if (parsed['source'] == null && parsed['source_bk'] == null)
if (parsed['source'] == null && parsed['source_bk'] == null) {
throw Exception("No stream found");
}

for (final src in parsed['source']) {
qualityList.add({
Expand Down Expand Up @@ -78,7 +79,7 @@ class Vidstream {
.querySelector('script[data-name="episode"]')
?.attributes['data-value'] ??
'';
if (val.length == 0) return null;
if (val.isEmpty) return null;
final Encrypter encrypter =
Encrypter(AES(keys['key'] as Key, mode: AESMode.cbc, padding: null));
final decrypted =
Expand All @@ -90,7 +91,7 @@ class Vidstream {
final res = await fetch(epLink);
final doc = html.parse(res);
final String link = doc.querySelector("iframe")?.attributes['src'] ?? '';
if (link.length == 0) return null;
if (link.isEmpty) return null;
return link;
}

Expand Down
1 change: 0 additions & 1 deletion lib/utils/sources/manga/base/source_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ abstract class SourceBase {
Future<dynamic> fetchMangaSearchResults(String query);
Future<dynamic> fetchChapterImages(
{required String mangaId, required String chapterId});
Future<dynamic> mapToAnilist(String query);
}

0 comments on commit f6aa5f6

Please sign in to comment.