16 lines
369 B
Dart
16 lines
369 B
Dart
class Resource<T> {
|
|
final T? data;
|
|
final bool isLoading;
|
|
final Exception? error;
|
|
|
|
Resource({this.data, this.isLoading = false, this.error});
|
|
|
|
Resource<T> copyWith({T? data, bool? isLoading, Exception? error}) {
|
|
return Resource<T>(
|
|
data: data ?? this.data,
|
|
isLoading: isLoading ?? this.isLoading,
|
|
error: error ?? this.error,
|
|
);
|
|
}
|
|
}
|