Auth in Flutter
--
Logging in using the Auth library package
Authentication is a common task put to mobile apps — making it an ideal candidate for a class library. A class library would execute the task in a formalized and standardized fashion — making authenticating a breeze. I use such a class library for my own apps in the form of the Dart package, Auth. I will use ‘example’ code to demonstrate this package. This example code can be viewed in the Dart package’s example tab. I’ll then follow up with the traditional ‘walkthrough’ the class library in nice ‘easy to read’ screenshots.
I Like Screenshots. Click For Gists.
As always, I prefer using screenshots over gists to show concepts rather than just show code in my articles. I find them easier to work with frankly. However, you can click or tap on these screenshots to see the code they represent in a gist or in Github. Ironically, it’s better to read this article about mobile development on your computer than on your phone. Besides, we program on our computers — not on our phones. For now.
Let’s begin.
Before you do anything
Before you do anything, you gotta set up Firebase. I’m not going to instruct you this step-by-step. You can do that on your own. I will, however, throw up some screenshots giving you hints on what you need to do and what you’ll likely see on your screen if you try to get ahead of yourself and run this library package.
Another point I should mention here. As it is, I’m Android. I’m originally an Android developer, not iOS, and so this next section applies more so to Android developers. I apologize to you iOS folk. Please, for you, how about we just skip this part and go to the rest of the article?
Now, as for the rest of you, maybe open up this website, Add Firebase to Your Android Project, as a supplement to help you set up Firebase as I’m going to describe this stuff in brief. Under the directory, android, add the following two dependencies to the build.gradle file.