Skip to content

Instantly share code, notes, and snippets.

@felangel felangel/login_state.dart
Last active Oct 9, 2018

Embed
What would you like to do?
[bloc_package] LoginState
class LoginState {
final bool isLoading;
final bool isLoginButtonEnabled;
final String error;
final String token;
const LoginState({
@required this.isLoading,
@required this.isLoginButtonEnabled,
@required this.error,
@required this.token,
});
factory LoginState.initial() {
return LoginState(
isLoading: false,
isLoginButtonEnabled: true,
error: '',
token: '',
);
}
factory LoginState.loading() {
return LoginState(
isLoading: true,
isLoginButtonEnabled: false,
error: '',
token: '',
);
}
factory LoginState.failure(String error) {
return LoginState(
isLoading: false,
isLoginButtonEnabled: true,
error: error,
token: '',
);
}
factory LoginState.success(String token) {
return LoginState(
isLoading: false,
isLoginButtonEnabled: true,
error: '',
token: token,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.