mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-03-11 17:25:32 +00:00
22 lines
646 B
Dart
22 lines
646 B
Dart
import 'package:isar_community/isar.dart';
|
|
import 'package:mangayomi/main.dart';
|
|
import 'package:mangayomi/models/chapter.dart';
|
|
import 'package:mangayomi/models/manga.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
part 'isar_providers.g.dart';
|
|
|
|
@riverpod
|
|
Stream<Manga?> getMangaDetailStream(Ref ref, {required int mangaId}) async* {
|
|
yield* isar.mangas.watchObject(mangaId, fireImmediately: true);
|
|
}
|
|
|
|
@riverpod
|
|
Stream<List<Chapter>> getChaptersStream(
|
|
Ref ref, {
|
|
required int mangaId,
|
|
}) async* {
|
|
yield* isar.chapters
|
|
.filter()
|
|
.manga((q) => q.idEqualTo(mangaId))
|
|
.watch(fireImmediately: true);
|
|
}
|