feat: add auth screens and state management
This commit is contained in:
18
lib/auth/auth_state.dart
Normal file
18
lib/auth/auth_state.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
|
||||
class AuthState extends ChangeNotifier {
|
||||
User? _user;
|
||||
User? get user => _user;
|
||||
|
||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||
|
||||
AuthState() {
|
||||
_auth.authStateChanges().listen((user) {
|
||||
_user = user;
|
||||
notifyListeners();
|
||||
});
|
||||
}
|
||||
|
||||
bool get isLoggedIn => _user != null;
|
||||
}
|
||||
Reference in New Issue
Block a user