SystemNotifier class abstract
UI-only callbacks for global API error handling.
BifrostRepository invokes these when a request fails. Implementations should show snackbars, dialogs, or navigation — not log. HTTP and repository diagnostics go through bifrostLogger on RestAPI and BifrostRepository.
Example:
class AppNotifier implements SystemNotifier {
@override
void onNetworkError() {
showSnackbar('No internet connection');
}
@override
void onUnauthorized() {
authService.logout();
navigator.pushReplacementNamed('/login');
}
@override
void onRequestFailed({required int statusCode, String? body}) {
final message = statusCode >= 500
? 'Something went wrong. Please try again.'
: 'Request failed ($statusCode)';
showSnackbar(message);
}
}
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onNetworkError(
) → void - No usable HTTP response (offline with no cache, transport error, etc.).
-
onRequestFailed(
{required int statusCode, String? body}) → void - Any other non-success HTTP status (403, 4xx, 5xx).
- HTTP 401 — session expired or not authenticated.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited