20 lines
672 B
Dart
20 lines
672 B
Dart
import 'package:isar/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';
|
|
import 'package:flutter_riverpod/flutter_riverpod.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);
|
|
}
|