Created
June 4, 2019 17:52
-
-
Save aaronksaunders/a301e630239b4aa64a5b2ada0579d1fd to your computer and use it in GitHub Desktop.
Markdium-Simple Firebase Login Flow in Flutter, Now Firebase
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
onPressed: () async { | |
// save the fields.. | |
final form = _formKey.currentState; | |
form.save(); | |
// Validate will return true if is valid, or false if invalid. | |
if (form.validate()) { | |
try { | |
FirebaseUser result = | |
await Provider.of(context).loginUser( | |
email: _email, password: _password); | |
print(result); | |
} on AuthException catch (error) { | |
// handle the firebase specific error | |
return _buildErrorDialog(context, error.message); | |
} on Exception catch (error) { | |
// gracefully handle anything else that might happen.. | |
return _buildErrorDialog(context, error.toString()); | |
} | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment