refactored and condensed technical documentation and comments across the codebase to improve readability

This commit is contained in:
2026-07-06 23:17:06 +02:00
parent c48f5ef215
commit a19b67eb84
27 changed files with 99 additions and 193 deletions
@@ -45,11 +45,8 @@ class LoadableStateBloc extends Bloc<LoadableStateEvent, LoadableStateState>
return;
}
_lastResumeRefetch = now;
// Re-check connectivity. The resulting [ConnectivityChanged] event takes
// it from there: its handler updates the offline/online indicator and
// triggers [reFetch] when the device is connected, so a stale
// "Verbindung fehlgeschlagen" bar from a suspend-time fetch clears as
// soon as the network is reachable again.
// Re-check connectivity so the resulting [ConnectivityChanged] handler
// clears a stale error bar and triggers [reFetch] once reachable again.
unawaited(
Connectivity().checkConnectivity().then(
(result) =>
@@ -65,11 +65,9 @@ class LoadableStateConsumer<
final showError = hasError && !hasContent;
final showErrorBar = hasError && hasContent;
// Keep the wrapper hierarchy stable across refresh cycles. The bloc clears
// reFetch to null while a refetch is in flight and restores it on
// completion; flipping the RefreshIndicator in and out on that signal
// would change the widget tree under the ListView and reset its scroll
// position every refresh.
// Keep the wrapper hierarchy stable across refresh cycles: reFetch flips to
// null mid-refetch, and toggling the RefreshIndicator on that signal would
// rebuild the tree under the ListView and reset its scroll position.
final content = SizedBox(
height: MediaQuery.of(context).size.height,
child: hasContent
@@ -128,10 +128,8 @@ abstract class LoadableHydratedBloc<
gatherData()
.catchError((e) {
log('Error while fetching ${TState.toString()}: ${e.toString()}');
// The bloc may have been closed before this async error landed (e.g.
// when its scoping widget tree was disposed mid-fetch). Adding to a
// closed bloc throws "Cannot add new events after calling close",
// so swallow that case quietly.
// The bloc may have been closed before this async error landed;
// adding to a closed bloc throws, so swallow that case.
if (isClosed) return;
add(
Error(