FetchingState<T> class
FetchingState allow you to handle UI base on the current state of data fetching Use this one when you want to attach your data object into the state. call FetchingState.data to get your object data
Constructors
- FetchingState({required T data, Object? error, required LoadState fetchingStatus})
- FetchingState.init({required T data, Object? error})
-
Create new FetchingState instance, default status to
LoadState.init
factory
Properties
- data → T
-
data that pass to
onDone
final - error → Object?
-
data that pass to
onError
final - fetchingStatus → LoadState
-
fetching status
LoadState
final - hashCode → int
-
The hash code for this object.
no setteroverride
- isDone → bool
-
Shortcut for checking if current status is done
no setter
- isError → bool
-
Shortcut for checking if current status is error
no setter
- isInit → bool
-
Shortcut for checking if current status is init
no setter
- isLoading → bool
-
Shortcut for checking if current status is loading
no setter
- isLoadingMore → bool
-
Shortcut for checking if current status is loading more data
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWhenDone(
{T? data}) → FetchingState< T> -
create new instance of FetchingState.
set status to
LoadState.done
keep the currentdata
and error or user can pass in those parameter. this method should be use after loading more item into data -
copyWhenError(
{T? data, Object? error}) → FetchingState< T> -
create new instance of FetchingState.
set status to
LoadState.error
keep the currentdata
anderror
or user can pass in those parameter. this method should be use after loading more item into data -
copyWhenLoading(
) → FetchingState< T> -
create new instance of FetchingState.
set status to
LoadState.loading
keep the current data and error or user can pass in those parameter. this is helpful when you want to add more data into current data -
copyWhenLoadingMore(
) → FetchingState< T> -
create new instance of FetchingState.
set status to
LoadState.loadingMore
keep the current data and error or user can pass in those parameter. this is helpful when you want to add more data into current data -
copyWith(
{required LoadState fetchingStatus, T? data, Object? error}) → FetchingState< T> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
when<
R> ({required R onLoading(), required R onDone(T? data, bool isLoadingMore), required R onError(Object? error), required R onInit()}) → R - Declare methods base on fetchingStatus that return widgets
-
whenOrElse<
R> ({R onLoading()?, R onDone(T? data, bool isLoadingMore)?, R onError(Object? error)?, R onInit()?, required R orElse()?}) → R - Declare methods that return widgets base on fetchingStatus
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override