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)
const
factory
DataState.idle()
const
factory
DataState.loading()
const
factory
DataState.success(T? value)
const
factory

Properties

error Object?

Available on DataState<T>, provided by the DataStateExtensions extension

no setter
hasError bool

Available on DataState<T>, provided by the DataStateExtensions extension

no setter
hashCode int
The hash code for this object.
no setterinherited
isIdle bool

Available on DataState<T>, provided by the DataStateExtensions extension

no setter
isIdleOrLoading bool

Available on DataState<T>, provided by the DataStateExtensions extension

no setter
isLoading bool

Available on DataState<T>, provided by the DataStateExtensions extension

no setter
isSuccess bool

Available on DataState<T>, provided by the DataStateExtensions extension

no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T?

Available on DataState<T>, provided by the DataStateExtensions extension

no 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<T>, provided by the DataStatePatterns extension

A switch-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<T>, provided by the DataStatePatterns extension

A variant of map that fallback to returning null.
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<T>, provided by the DataStatePatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult idle()?, TResult loading()?, TResult error(Object error)?, TResult success(T? value)?, required TResult orElse()}) → TResult

Available on DataState<T>, provided by the DataStatePatterns extension

A variant of when that fallback to an orElse callback.
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<T>, provided by the DataStatePatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? idle()?, TResult? loading()?, TResult? error(Object error)?, TResult? success(T? value)?}) → TResult?

Available on DataState<T>, provided by the DataStatePatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) bool
The equality operator.
inherited