Skip to content

Instantly share code, notes, and snippets.

@SAGARSURI
Created July 21, 2019 12:34
Show Gist options
  • Select an option

  • Save SAGARSURI/e13cea201a5857c3255d550dfa5fff2f to your computer and use it in GitHub Desktop.

Select an option

Save SAGARSURI/e13cea201a5857c3255d550dfa5fff2f to your computer and use it in GitHub Desktop.
class State<T>{
State._();
factory State.success(T value) = SuccessState<T>;
factory State.error(T msg) = ErrorState<T>;
}
class ErrorState<T> extends State<T> {
ErrorState(this.msg) : super._();
final T msg;
}
class SuccessState<T> extends State<T> {
SuccessState(this.value) : super._();
final T value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment