Updated and *way simpler* APIs

This commit is contained in:
venir.dev
2023-10-28 17:50:13 +02:00
parent f1e5a29e1e
commit 16c499193f
5 changed files with 84 additions and 127 deletions

View File

@ -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,
};
}