Flutter & Firebase App Tutorial #2 - Firebase Setup

Net Ninja · Beginner ·🛠️ AI Tools & Apps ·6y ago

Key Takeaways

Configures a Flutter app to use Firebase services such as database and authentication

Full Transcript

okay they're my friends so the aim of the game here is to link up a firebase back end to our flutter up because firebase is going to help us to take care of things like authentication and storing data in a database on the backend and so we need to link up our flutter application that we're creating to this firebase back-end so we're going to go through that process in this video now the first thing you need to do is go to firebase google.com and then create a free account once you've done that click on go to console and this is going to list your current projects I've already got two but if this is the first time you've created an account you won't have any yet you want to create a new project by clicking add project and the first thing we need to do is give our project a name now just a word of warning firebase does like to change the design of its website weekly it seems in my case but it doesn't mean that the service has changed it just means that it's changing the UI so you might see something different but the process is going to be very similar but anyway we need to give this project a name I'm going to call this ninja brew crew and then continue and then down here you can uncheck that because we don't really need analytics and then create the project this is just going to take a minute or so to create this project for us okay then so once that's done click on continue and you're going to see this kind of like a control area for your firebase container or firebase project so we have all of these different links on the left to setup different features of our 5x back end things like authentication or the database or storage etc and we also have these options right here to setup a new app for this back-end so we do want to do that we want to set up a new Android app for our back-end so let's click on this Android icon right here and we need to give this first of all a package name now if you've used Android studio to create a new flutter' application in the past then when you create that you have to specify that package name at the start and it's going to be that value but in vs code we didn't do that it automatically creates this value forest but you can find it it's inside the Android then go into up and then open build.gradle and you're gonna see if you scroll down this thing right here application ID let me just zoom in a little bit so you can see this and this thing right here this is the application ID value so at the minute we can see that this is comp doctor net ninja recruit but I have actually entered that in here manually now for you it should be something like calm down example dots whatever you called your app so just change the example bit to your name or your website or something like that it just has to be unique what I'm going to do is copy this value right here and then I'm going to paste it into this field and that is going to be our package name now we have to give this a nickname well it's optional but I'm going to give it a nickname of brew crew like so oops there we go and then this bit right here we don't need to fill in because we're not going to be using Google signing off phone number support so we can just register the app like so and then the next step is to download this Google services JSON file this is a file we're going to place in our project in this folder structure so that when our project starts in the emulator or on the phone then this Google services dot JSON file is going to tell that project what back-end to connect to on firebase it's gonna act as like an identifier so it knows to connect to our back-end right here so make sure you download that and then it should only take a second to download when it does just grab it and you want to paste it over here inside your project now we takes the inside this app folder right here so just grab it and scoot it over to this app folder inside the Android folder right there okay so that's the first step taken care of now let's carry on go to next and now we need to add a couple of snippets to some different files in our project as well now at this point I want you to make sure that you use exactly the same version numbers as me because when you're setting up firebase in a flutter out there are certain things that and go wrong with different versions of different things but if you use all of the same versions of everything that I use then hopefully that's going to minimize that risk so first of all we want to place this thing right here this particular class path inside our build the Gradle file in the project route so let me copy this and go to our project now we have a build up Gradle file right here but it's not in the project route so let's just get rid of this app thing right here and you want to go down to this build.gradle thing right here this is the one we want to add it to so inside dependencies just paste this in now I'm gonna change this to 4.0.1 that is the version that we're gonna go with in this series now there could be slight problems if you use a different version because sometimes like I say when you setting up firebase with flutter different things can conflict with one another so if you want to make sure there's no problems make sure your version is the same as mine 4.0.1 okay so let's move on the next thing we need to do is grab this thing right here this plugin so copy that and we need to add that at the bottom of this file inside the project then the app then build up Gradle so this time around we want to go into the app folder then build up Gradle and we want to come to the bottom and we want to paste that in or right at the bottom right here so this time it's this build up Gradle and not the other one so make sure you get those the right way around I'm gonna save this and in fact I'm just gonna scroll up and I'm gonna change the minimum SDK version as well to 21 so we're not going as far back into the past with our support so make sure you do that as well this dates back to around about 2014 I think version 21 so it does go back a fair few years so now if we save that I want to open up my main file if I can find it in all of this mess now so open that up then I'm gonna click f5 to run this like so which is cross that off and then when it's ready it'll open up inside this emulator so at the minute we just want to make sure that everything is still working and that is a good sign if you get some errors it means you've probably done something wrong at some point but hopefully fingers crossed this should run with no errors okay and the app works with who so that means that we've kind of set everything up correctly and if you just open your console and go to debug console as long as there's nothing kind of red in here then you should be fine to carry-out so we're kind of halfway there now we've now connected our flutter application with firebase as a back-end so now we're free to start communicating with that back-end but in order to do that properly we're going to have to now install a couple of flutter packages so that we can interact with the firebase backend appropriately in a flutter application so the first thing I'm going to add is this thing right here firebase earth so if we go to installing we can see right here we want to grab this thing firebase auth copy that take note with the version number that's what I'm using and I can minimize that then if I go down to this thing over here and go to the pub spec gamma file we want to scroll down to our dependencies and at the bottom of those we can just add in firebase auth now the next package I want to install is the cloud fire store so let me zoom that over here go to installing and grab this thing I'm going to copy that and cross it off and I'm going to paste that underneath here and save it and if we now refresh we can see it's getting those packages if we now refresh hopefully everything should still be working the same and I can see everything still works and in the debug console we see no errors so there we go my friends now we have firebase setup for our application so that we can start to interact with it on the backend there's actually one more thing we need to do in this video and that's just to go back to our firebase console and finish this setup so click Next right now and then click on continue to console and now we can see this blue group up right up here so that's all sorted now so in the next video what I want to do is just take a step back so that we can have a bit of a bird's-eye view of how we're going to structure our application and talk about what different widgets we're going to use and where so we'll talk about that in the next video

Original Description

Hey gang, in this Flutter & Firebase tutorial we'll go through the steps needed to set up Firebase in our Flutter app, so that we can use the database and auth services later on. ---------------------------------------- 🐱‍💻 🐱‍💻 Course Links: Course files - https://github.com/iamshaunjp/flutter-firebase/tree/lesson-2 🐱‍💻 🐱‍💻 Other Related Courses: + Flutter Tutorial for Beginners - https://www.youtube.com/playlist?list=PL4cUxeGkcC9jLYyp2Aoh6hcWuxFDX6PBJ + Firebase Auth Tutorial - https://www.youtube.com/playlist?list=PL4cUxeGkcC9jUPIes_B8vRjn1_GaplOPQ + Firebase Firestore Tutorial - https://www.youtube.com/playlist?list=PL4cUxeGkcC9itfjle0ji1xOZ2cjRGY_WB
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Net Ninja · Net Ninja · 0 of 60

← Previous Next →
1 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
4 GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

Related AI Lessons

Up next
How to Open HPL Files (HP-GL Plotter)
File Extension Geeks
Watch →