opt: query data

fix: webdav backup

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-10 00:00:37 +08:00
parent 36ff4a0ed3
commit cef7bfd534
5 changed files with 68 additions and 39 deletions

View File

@@ -2,25 +2,52 @@ abstract class LoadingState<T> {
const LoadingState();
factory LoadingState.loading() = Loading;
// factory LoadingState.empty() = Empty;
factory LoadingState.success(T response) = Success<T>;
factory LoadingState.error(String errMsg) = Error;
}
class Loading extends LoadingState<Never> {
const Loading();
}
Loading._internal();
// class Empty extends LoadingState<Never> {
// const Empty();
// }
static final Loading _instance = Loading._internal();
factory Loading() => _instance;
}
class Success<T> extends LoadingState<T> {
final T response;
const Success(this.response);
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other is Success) {
return response == other.response;
}
return false;
}
@override
int get hashCode => response.hashCode;
}
class Error extends LoadingState<Never> {
final String errMsg;
const Error(this.errMsg);
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other is Error) {
return errMsg == other.errMsg;
}
return false;
}
@override
int get hashCode => errMsg.hashCode;
}