courseISchoolPresentation function
Implementation
CourseISchoolPresentation courseISchoolPresentation({
required bool hasCache,
required bool showNetworkGuide,
required bool allowEarlyNetworkGuide,
required AsyncValue<bool> refresh,
required AsyncValue<void> availability,
}) {
final refreshSucceeded = refresh.value == true;
if (hasCache) {
return showNetworkGuide && !refreshSucceeded ? .guide : .content;
}
final availabilityFailed = availability.hasError && !availability.isLoading;
final refreshFailed = refresh.hasError && !refresh.isLoading;
if ((showNetworkGuide ||
(availabilityFailed && (allowEarlyNetworkGuide || refreshFailed))) &&
!refreshSucceeded) {
return .guide;
}
if (refreshFailed && !availability.isLoading) {
return .genericFailure;
}
return .loading;
}