Last active
April 25, 2022 12:38
-
-
Save NoaTubic/8674a4a2d99dc9f8e54d0f1e5e85d480 to your computer and use it in GitHub Desktop.
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
Future<User> signInOrCreateAccount( | |
BuildContext context, Future<UserCredential> Function() signInFunc) async { | |
try { | |
final userCredential = await signInFunc(); | |
await maybeCreateUser(userCredential.user); | |
return userCredential.user; | |
} on FirebaseAuthException catch (e) { | |
ScaffoldMessenger.of(context).hideCurrentSnackBar(); | |
ScaffoldMessenger.of(context).showSnackBar( | |
SnackBar(content: Text('Error: ${e.message}')), | |
); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment