Resource<T> class

Annotations

Constructors

Resource({required T? data, required Status status, AppException? error})
Resource.failed({dynamic error, T? data})
Resource.loading({T? data})
Resource.success({T? data})

Properties

data → T?
final
error AppException?
final
hashCode int
The hash code for this object.
no setteroverride
isFailed bool
no setter
isLoading bool
no setter
isSuccess bool
no setter
message String
no setter
metaData → ResourceMetaData<T>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status Status
final

Methods

addData(Status newStatus, T? newData, {AppException? error}) Resource<T>
mergeStatus(Resource? other) Resource<T?>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
transformData<O>(O transformData(T? data)) Resource<O>

Operators

operator ==(Object o) bool
The equality operator.
override

Static Methods

asFuture<T>(Future<T> req()) Future<Resource<T>>
asRequest<T>(T req()) Resource<T>
setErrorMapper(AppException errorMapper(dynamic e)) → void