Created
July 28, 2020 04:19
-
-
Save theindianappguy/a1df5d2ae279abdaa291e72038c8031b to your computer and use it in GitHub Desktop.
This file contains hidden or 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'; | |
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