fetchChapterById method

Future<Chapter?> fetchChapterById(
  1. int chapterId
)

Implementation

Future<Chapter?> fetchChapterById(int chapterId) async {
  Chapter? chapter = await _chapterLocalDataSource.fetchChapterById(chapterId);
  if (chapter != null) {
    return chapter;
  } else {
    final MyResponse<Chapter> response = await _chapterApi.fetchChapterById(chapterId);
    if (response.code == Apis.CODE_SUCCESS) {
      chapter = response.data as Chapter?;
    }
    return chapter;
  }
}