mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
refactor: rcmd hot
This commit is contained in:
26
lib/http/loading_state.dart
Normal file
26
lib/http/loading_state.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
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();
|
||||
}
|
||||
|
||||
class Empty extends LoadingState<Never> {
|
||||
const Empty();
|
||||
}
|
||||
|
||||
class Success<T> extends LoadingState<T> {
|
||||
final T response;
|
||||
const Success(this.response);
|
||||
}
|
||||
|
||||
class Error extends LoadingState<Never> {
|
||||
final String errMsg;
|
||||
const Error(this.errMsg);
|
||||
}
|
||||
Reference in New Issue
Block a user