次のように拡張するクラスがありますChangeNotifier
。
class NovelNotifier extends BaseNotifier {
List<Novel> novels = [];
Future<void> addListNovelByCategoryID({
@required String id,
int page = 1,
int sort = 0,
int status = 0,
int totalChapter = 0,
}) async {
busy(true);
final items = await _getListNovelFilter(
id: id,
url: urlGetNovelsFilter,
page: page,
sort: sort,
status: status,
totalChapter: totalChapter,
);
novels.addAll(items);
busy(false);
}
}
addListNovelByCategoryID
id
カテゴリ ID を表す param に基づいてバックエンド API を呼び出します。そして、私は14のカテゴリを持っているので、独自のデータを持つ14の個別のリストが必要で、TabBarView
.
複数のセットアップを計画しましたが、このケースをサポートする方法やサポートChangeNotifierProvider<NovelNotifier>
するかどうかはわかりません。Provider