FetchingState<T, E> class
FetchingState allow you to handle UI base on the current state of data fetching
Constructors
- FetchingState({T? data, E? error, required FetchingStatus fetchingStatus})
- FetchingState.done({T? data})
-
Create new FetchingState instance, default status to FetchingStatus.done
factory
- FetchingState.error({E? error})
-
Create new FetchingState instance, default status to FetchingStatus.error
factory
- FetchingState.init()
-
Create new FetchingState instance, default status to FetchingStatus.init
factory
- FetchingState.loading()
-
Create new FetchingState instance, default status to FetchingStatus.loading
factory
Properties
- data → T?
-
data that pass to
onDone
final - error → E?
-
data that pass to
onError
final - fetchingStatus → FetchingStatus
-
fetching status FetchingStatus
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isDone → bool
-
Shortcurt for checking if current status is done
no setter
- isError → bool
-
Shortcurt for checking if current status is error
no setter
- isInit → bool
-
Shortcurt for checking if current status is init
no setter
- isLoading → bool
-
Shortcurt for checking if current status is loading
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{required FetchingStatus fetchingStatus}) → FetchingState -
map<
R> ({required R onLoading(), required R onDone(T? data), required R onError(E? error), required R onInit()}) → R - Declare methods base on fetchingStatus
-
mapOrElse<
R> ({R onLoading()?, R onDone(T? data)?, R onError(E? error)?, R onInit()?, required R orElse()?}) → R -
Declare methods that return
R
base on fetchingStatus -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
when(
{required Widget onLoading(), required Widget onDone(T? data), required Widget onError(E? error), required Widget onInit()}) → Widget - Declare methods base on fetchingStatus that return widgets
-
whenOrElse(
{Widget onLoading()?, Widget onDone(T? data)?, Widget onError(E? error)?, Widget onInit()?, required Widget orElse()?}) → Widget - Declare methods that return widgets base on fetchingStatus
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override