Created
September 3, 2021 15:25
-
-
Save diefferson/3d9be1a1c40beefc8e956bf94b4795e2 to your computer and use it in GitHub Desktop.
BaseState Flutter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseState { | |
BaseState._(); | |
factory BaseState.success(dynamic data) = SuccessState; | |
factory BaseState.error(NoodleException error) = ErrorState; | |
factory BaseState.loading() = LoadingState; | |
factory BaseState.done() = DoneState; | |
} | |
class ErrorState extends BaseState { | |
ErrorState(this.error) : super._(); | |
final NoodleException error; | |
} | |
class LoadingState extends BaseState { | |
LoadingState() : super._(); | |
} | |
class DoneState extends BaseState { | |
DoneState() : super._(); | |
} | |
class SuccessState extends BaseState { | |
SuccessState(this.data) : super._(); | |
final dynamic data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment