In Jan 24, 2019, firebase_auth migrated to AndroidX essentially cutting off the previous Android versions. This package retains those versions if you need to use them. In other words, if you want to not migrate just yet, use this package that will, in turn, continue to use firebase_auth 0.7.0. You may have to consider useing this package if, for example, you encounter the following error: The common solution (in most cases) requires you to 'upgrade' minSdkVersion to at least, 21:
This class library works with two plugins: firebase_auth and google_sign_in to log into a Firebase backend using a Firebase account or a Google account. If you're familiar with these plugins, you will find the same functions used in this class library.
How it Works
Below are a series of screenshots depicting how to initialize and authenticate or 'sign in' an individual in your app's Firebase backend using a either an email and password or a Google account. The following will sign in 'silently' (i.e. automatically if the user had already signed in in the past.). Note, settings are passed as parameters in the screenshot below. These examples have the class library called in the State object's iniState() function, but, of course, you could instead 'initialize' the class library in the iniState() function and then 'sign in' elsewhere. Below, the init() function is used instead to initialize the class library.
The class library provide an array of setters that you can use instead to first initialize. The 'listen' setter will call the anonymous function when the user either successfully or unsuccessfully logs in.
The Last Setter Wins
By design, the last assignment of a particular setting is the one used by the class library. The the example blow, there is a stretch of code that calls the 'scopes' setting twice. The last instance (in the signInSliently() function) will be the one used. Below is a snapshot of the logInWithGoogle() function inside the class library itself. It is this function you will likely use the most. It does the majority of the functionality. It will log in 'silently' if possible, otherwise it will use the user's Google account to log into Firebase. This snapshot gives you an idea of the parameters (options) you have available to you. Again, if you're familiar with the plugins, you'll recognize most of these parameters.
It's All Static
It's a static class library, and so prefix the word, 'Auth', in front of the function call 'anytime anywhere' in the app, and you're off and running.
This is a library is covered again in the Medium article, Auth in Flutter.