core library

Brix core block: Result, Failure, Json and BrixLogger, shared by every other block.

Classes

BrixFlow<S>
Base of every brix flow: holds one immutable state S and tells listeners when it changes.
BrixLogger
A readable console log for apps, one box per message, so lines that come one after another never run together:
Failed<T>
The call did not work; failure says why.
Failure
Why something did not work. Every block (auth, network, account, ...) reports problems with these classes instead of plain strings, so an app can react to the kind of problem, not only show a text.
Json
A safe way to read decoded JSON (from any backend: REST, Firebase, Supabase, ...) into your own models.
NetworkFailure
No connection or the request timed out.
Result<T>
Outcome of any brix call: Success or Failed, nothing else.
ServerFailure
The server failed or answered with an unexpected status.
Success<T>
The call worked. For calls without data use Success<void>(null).
UnauthorizedFailure
Not logged in or the session ended (HTTP 401).
UnknownFailure
Anything else. cause keeps the original error for logging; it is never meant to be shown to the user.
UnsupportedFailure
The backend does not offer this call (e.g. OTP on a link-only backend).
ValidationFailure
The input was rejected (HTTP 400 / 422, form rules on the server).

Enums

LogLevel
How important a log line is. Lines below BrixLogger.minLevel are skipped.

Functions

failureFromError(Object error, StackTrace stackTrace) → Failure
Default way to turn a thrown error into a Failure.