Last active
July 6, 2022 19:17
-
-
Save pawelsa/2333b5a6ff0b399cd5cc8a07413e80ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final LoadingStatus _upcomingMoviesLoadingStatus = LoadingStatus(); | |
Future<Result> getUpcomingMovies(int page) { | |
_upcomingMoviesLoadingStatus.isLoading = true; | |
return _movieApi.getUpcoming(page).then((content) { | |
if (content is ContentListResponse) { | |
final result = _getMoviesWithResp(content, false); | |
_upcomingMoviesLoadingStatus.isLoading = false; | |
return result; | |
} | |
_upcomingMoviesLoadingStatus.isLoading = false; | |
return ErrorResult(ErrorCause.noInternet()); | |
}); | |
} | |
DataStream<List<ContentDetailData>> observeDetailedUpcoming() => | |
_movieDao.observeAllUpcoming() | |
.asyncMap(getDetailsFromDb) | |
.withLoading(_upcomingMoviesLoadingStatus); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment