Frontend first draft
This commit is contained in:
15
frontend/pshared/lib/provider/resource.dart
Normal file
15
frontend/pshared/lib/provider/resource.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user