mirror of
https://github.com/lucavenir/go_router_riverpod.git
synced 2025-08-06 14:59:53 +08:00
22 lines
546 B
Dart
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,
|
|
};
|
|
}
|