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
zip -d Archive.zip "__MACOSX*" |
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
flutterfire configure --project="<name of firebase project (general, not app)>" --out="lib/prod_options.dart" -i <ios bundle id -a <android app id> -y |
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
git rm --cached `git ls-files -i -c --exclude-from=.gitignore` |
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
Widget _buildBody(StreamData<List<ContentData>> streamData){ | |
return Stack( | |
children: [ | |
ListView.builder( | |
itemCount: streamData.data.length, | |
itemBuilder: (context, index) { | |
final item = streamData.data[index]; | |
return CardItem( | |
onTap: () => _onCardTap(context, item), | |
content: item, |
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; | |
} |
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
extension LoadingStatusStreamExtension<T> on Stream<T> { | |
DataStream<T> withLoading(LoadingStatus loadingStatus) { | |
return combineLatest<bool, StreamData<T>>(loadingStatus.listen(), | |
(data, isLoading) { | |
if (isLoading) { | |
return LoadingData(data); | |
} | |
return ReadyData(data); | |
}); | |
} |
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(); | |
DataStream<List<ContentDetailData>> observeDetailedUpcoming() => | |
_movieDao.observeAllUpcoming().asyncMap(getDetailsFromDb).combineLatest<bool, | |
StreamData<List<ContentDetailData>>>(_upcomingMoviesLoadingStatus.listen(), | |
(data, isLoading) { | |
if (isLoading) { | |
return LoadingData(data); | |
} | |
return ReadyData(data); | |
}); |
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
class LoadingStatus { | |
BehaviorSubject<bool>? _loadingController; | |
bool _isLoading = false; | |
bool _streamedInitialEvent = false; | |
set isLoading(bool isLoading) { | |
_isLoading = isLoading; | |
_publishLoadingState(); | |
} |
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
@freezed | |
class StreamData<T> with _$StreamData<T> { | |
factory StreamData.ready(T data) = ReadyData<T>; | |
factory StreamData.loading(T data) = LoadingData<T>; | |
} |
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
@freezed | |
class ErrorCause with _$ErrorCause { | |
const factory ErrorCause.noInternet() = NoInternetError; | |
const factory ErrorCause.databaseSave() = DatabaseSaveError; | |
const factory ErrorCause.unknown() = UnknownError; | |
} | |
@freezed |
NewerOlder