mirror of
https://github.com/lucavenir/go_router_riverpod.git
synced 2025-08-26 07:21:08 +08:00
Updated and *way simpler* APIs
This commit is contained in:
@ -5,13 +5,17 @@ part 'auth.freezed.dart';
|
||||
/// Authentication class for this sample application.
|
||||
/// It should be self-explanatory.
|
||||
@freezed
|
||||
class Auth with _$Auth {
|
||||
sealed class Auth with _$Auth {
|
||||
const factory Auth.signedIn({
|
||||
required int id,
|
||||
required String displayName,
|
||||
required String email,
|
||||
required String token,
|
||||
}) = SignedIn;
|
||||
|
||||
const Auth._();
|
||||
const factory Auth.signedOut() = SignedOut;
|
||||
bool get isAuth => switch (this) {
|
||||
SignedIn() => true,
|
||||
SignedOut() => false,
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user