Created
February 26, 2022 19:00
-
-
Save pawelsa/1cfa879fb41133ab6b7f0b7422be40c5 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
// Before | |
Future<List<ContentDetailData>> getPopularMovies(int page) => | |
_movieApi.getPopular(page).then((content) => _getMovies(content, true)); | |
Future<List<ContentDetailData>> _getMovies( | |
PageContent content, bool arePopular) async { | |
// save, map and perform other operations | |
} | |
// After | |
Future<List<ContentDetailData>> getPopularMovies(int page) => | |
_movieApi.getPopular(page).then((content) { | |
if (content is ContentListResponse) { | |
return _getMovies(content, true); | |
} | |
return <ContentDetailData>[]; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment