sub_state library
🧩 sub_state — a lightweight, type-safe state holder for Dart & Flutter.
Every operation lives in exactly one of four states — initial, loading,
success or failure — modelled with Dart 3 sealed classes. That gives
you compile-time-exhaustive switch pattern matching for free, plus the
familiar when / map / copyWith helpers.
Pick the variant that matches how many success values you carry: SubState (1) · SubState2 (2) · SubState3 (3) · SubState4 (4) · SubState5 (5).
Classes
-
Sub2Failure<
T1, T2, TError> -
Sub2Initial<
T1, T2, TError> -
Sub2Loading<
T1, T2, TError> -
Sub2Success<
T1, T2, TError> -
Sub3Failure<
T1, T2, T3, TError> -
Sub3Initial<
T1, T2, T3, TError> -
Sub3Loading<
T1, T2, T3, TError> -
Sub3Success<
T1, T2, T3, TError> -
Sub4Failure<
T1, T2, T3, T4, TError> -
Sub4Initial<
T1, T2, T3, T4, TError> -
Sub4Loading<
T1, T2, T3, T4, TError> -
Sub4Success<
T1, T2, T3, T4, TError> -
Sub5Failure<
T1, T2, T3, T4, T5, TError> -
Sub5Initial<
T1, T2, T3, T4, T5, TError> -
Sub5Loading<
T1, T2, T3, T4, T5, TError> -
Sub5Success<
T1, T2, T3, T4, T5, TError> -
SubFailure<
TSuccess, TError> - The failed variant of SubState, carrying error.
-
SubInitial<
TSuccess, TError> - The idle variant of SubState.
-
SubLoading<
TSuccess, TError> - The in-flight variant of SubState.
-
SubState<
TSuccess, TError> -
A type-safe state for an operation that yields a single value of type
TSuccess, or fails with an error of typeTError. -
SubState2<
T1, T2, TError> -
A type-safe state carrying two success values (
T1,T2) on success, or an error of typeTErroron failure. See SubState for the full API. -
SubState3<
T1, T2, T3, TError> -
A type-safe state carrying three success values (
T1,T2,T3) on success, or an error of typeTErroron failure. See SubState for the full API. -
SubState4<
T1, T2, T3, T4, TError> -
A type-safe state carrying four success values (
T1–T4) on success, or an error of typeTErroron failure. See SubState for the full API. -
SubState5<
T1, T2, T3, T4, T5, TError> -
A type-safe state carrying five success values (
T1–T5) on success, or an error of typeTErroron failure. See SubState for the full API. -
SubSuccess<
TSuccess, TError> - The succeeded variant of SubState, carrying data.