Quotation
This commit is contained in:
@@ -5,11 +5,14 @@ class Resource<T> {
|
||||
|
||||
Resource({this.data, this.isLoading = false, this.error});
|
||||
|
||||
Resource<T> copyWith({T? data, bool? isLoading, Exception? error}) {
|
||||
static const _unset = Object();
|
||||
|
||||
Resource<T> copyWith({T? data, bool? isLoading, Object? error = _unset}) {
|
||||
return Resource<T>(
|
||||
data: data ?? this.data,
|
||||
isLoading: isLoading ?? this.isLoading,
|
||||
error: error ?? this.error,
|
||||
// Distinguish "not provided" from an explicit null to allow clearing error.
|
||||
error: error == _unset ? this.error : error as Exception?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user