0

I have a class that extends ChangeNotifier, like this:

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 will call Backend API based on id param, which represent category id. And I have like 14 categories, so I need 14 separated lists which has its own data and put them in TabBarView.

I planed to setup multiple ChangeNotifierProvider<NovelNotifier> but don't know how or whether Provider supports this case or not.

Joe Ng
  • 91
  • 2
  • 7

0 Answers0