DataState<T> class
sealed
A data class that represents the state of a request encapsulating the result of type T or error of type Object.
- Implemented types
- Available extensions
- Annotations
-
- @freezed
Constructors
- DataState.error(Object error)
-
constfactory
- DataState.idle()
-
constfactory
- DataState.loading()
-
constfactory
- DataState.success(T? value)
-
constfactory
Properties
- error → Object?
-
Available on DataState<
T> , provided by the DataStateExtensions extensionno setter - hasError → bool
-
Available on DataState<
T> , provided by the DataStateExtensions extensionno setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isIdle → bool
-
Available on DataState<
T> , provided by the DataStateExtensions extensionno setter - isIdleOrLoading → bool
-
Available on DataState<
T> , provided by the DataStateExtensions extensionno setter - isLoading → bool
-
Available on DataState<
T> , provided by the DataStateExtensions extensionno setter - isSuccess → bool
-
Available on DataState<
T> , provided by the DataStateExtensions extensionno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T?
-
Available on DataState<
T> , provided by the DataStateExtensions extensionno setter
Methods
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
map<
TResult extends Object?> ({required TResult idle(DataStateIdle< T> value), required TResult loading(DataStateLoading<T> value), required TResult error(DataStateError<T> value), required TResult success(DataStateSuccess<T> value)}) → TResult -
Available on DataState<
AT> , provided by the DataStatePatterns extensionswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> ({TResult? idle(DataStateIdle< T> value)?, TResult? loading(DataStateLoading<T> value)?, TResult? error(DataStateError<T> value)?, TResult? success(DataStateSuccess<T> value)?}) → TResult? -
Available on DataState<
A variant ofT> , provided by the DataStatePatterns extensionmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> ({TResult idle(DataStateIdle< T> value)?, TResult loading(DataStateLoading<T> value)?, TResult error(DataStateError<T> value)?, TResult success(DataStateSuccess<T> value)?, required TResult orElse()}) → TResult -
Available on DataState<
A variant ofT> , provided by the DataStatePatterns extensionmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> ({TResult idle()?, TResult loading()?, TResult error(Object error)?, TResult success(T? value)?, required TResult orElse()}) → TResult -
Available on DataState<
A variant ofT> , provided by the DataStatePatterns extensionwhenthat fallback to anorElsecallback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toGenericDataState(
) → GenericDataState -
Available on DataState<
T> , provided by the DataStateExtensions extension -
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
-
when<
TResult extends Object?> ({required TResult idle(), required TResult loading(), required TResult error(Object error), required TResult success(T? value)}) → TResult -
Available on DataState<
AT> , provided by the DataStatePatterns extensionswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> ({TResult? idle()?, TResult? loading()?, TResult? error(Object error)?, TResult? success(T? value)?}) → TResult? -
Available on DataState<
A variant ofT> , provided by the DataStatePatterns extensionwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited