Files
2023-10-28 18:04:32 +02:00

22 lines
546 B
Dart

import 'package:freezed_annotation/freezed_annotation.dart';
part 'auth.freezed.dart';
/// Authentication class for this sample application.
/// It should be self-explanatory.
@freezed
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,
};
}