Skip to content

Instantly share code, notes, and snippets.

@alefcarlos
Created May 29, 2019 20:03
Show Gist options
  • Save alefcarlos/b9eb87ff6b91bdeb494398a7a2a7d9b3 to your computer and use it in GitHub Desktop.
Save alefcarlos/b9eb87ff6b91bdeb494398a7a2a7d9b3 to your computer and use it in GitHub Desktop.
Exemplo de classe singleton para informações de usuãrio.
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