Skip to content

Instantly share code, notes, and snippets.

@theindianappguy
Created July 28, 2020 04:19
Show Gist options
  • Save theindianappguy/a1df5d2ae279abdaa291e72038c8031b to your computer and use it in GitHub Desktop.
Save theindianappguy/a1df5d2ae279abdaa291e72038c8031b to your computer and use it in GitHub Desktop.
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/widgets.dart';
class UserProvider with ChangeNotifier {
User _user;
AuthMethods _authMethods = AuthMethods();
User get getUser => _user;
reset() async {
_user = null;
}
Future<void> refreshUser() async {
FirebaseUser firebaseUser = await _authMethods.getCurrentUser();
_user = await _authMethods.getUserDetails(firebaseUser.uid);
print('[user-provider] ' + _user.name);
notifyListeners();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment