Last active
January 7, 2019 00:48
-
-
Save felangel/f2d7dd2dc2da511abbee4a0c8ad0f3ae to your computer and use it in GitHub Desktop.
[flutter_login_unit_tests] AuthenticationState
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
import 'package:meta/meta.dart'; | |
import 'package:equatable/equatable.dart'; | |
abstract class AuthenticationState extends Equatable { | |
AuthenticationState([Iterable props]) : super(props); | |
} | |
class AuthenticationUninitialized extends AuthenticationState { | |
@override | |
String toString() => 'AuthenticationUninitialized'; | |
} | |
class AuthenticationInitialized extends AuthenticationState { | |
final bool isLoading; | |
final bool isAuthenticated; | |
AuthenticationInitialized({ | |
@required this.isLoading, | |
@required this.isAuthenticated, | |
}) : super([isLoading, isAuthenticated]); | |
factory AuthenticationInitialized.authenticated() { | |
return AuthenticationInitialized( | |
isAuthenticated: true, | |
isLoading: false, | |
); | |
} | |
factory AuthenticationInitialized.unauthenticated() { | |
return AuthenticationInitialized( | |
isAuthenticated: false, | |
isLoading: false, | |
); | |
} | |
@override | |
String toString() => | |
'AuthenticationInitialized { isLoading: $isLoading, isAuthenticated: $isAuthenticated }'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment