Created
May 29, 2019 20:03
-
-
Save alefcarlos/b9eb87ff6b91bdeb494398a7a2a7d9b3 to your computer and use it in GitHub Desktop.
Exemplo de classe singleton para informações de usuãrio.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:firebase_auth/firebase_auth.dart'; | |
class UserDataInfo { | |
FirebaseUser _user; | |
UserDataInfo._(); | |
String get id => _user.uid; | |
String get email => isLoggedIn ? _user.email : null; | |
bool get isLoggedIn => _user != null; | |
static UserDataInfo instance = UserDataInfo._(); | |
Future<void> setUser(FirebaseUser user) async { | |
_user = user; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment