RequestState<T> class
Class that handles state, value and possible errors generated during a network data transmission.
Parameters:
- T: model which represents the type of the state.
Constructors
- RequestState.error(String error)
-
An error has been generated in the network request process
The error message is saved inside the errorMessage variable.
const
-
RequestState.fromJson(Map<
String, dynamic> json) -
Handles creation of network request state from a JSON (Map)
factory
- RequestState.init()
-
Initial state. It doesn't stores anykind of data or error message.
const
- RequestState.loaded(T data)
-
The request has been completed, and data has been received from the service.
Data's type is checked.
const
- RequestState.loading([T? previousValue])
-
Loading state, between initialization & data.
It also receives the previous value if available.
const
Properties
- errorMessage → String?
-
Variable which stores possible error messages during network operations
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → RequestStatus
-
Variable that represents the current state of the response operation
final
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited - value → T?
-
Storages the current value of the operation. Its type is defined by
the class itself.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Handles creation of JSON (Map) objects from a network request state
-
toString(
) → String - A string representation of this object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited