How to Insert Data in Firebase Realtime Database Flutter | Flutter Firebase Database CRUD 2022

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone and welcome to codingtest.com guys in this video i will show you how you can insert data in firebase real-time database using flutter so as you can see here i have already created a new flutter project and i have created uh two screens for fetching data and for inserting data and this is our main screen and if i show you so here as you can see if i click on this insert data so it will go to the inserting data screen from here we can insert data and if i click on this fetch data so it goes to the fetching layer screen and we will implement this screen in the upcoming videos so first of all we need to connect our flutter project with firebase i have already connected this uh flutter project with my firebase project and if you don't know how to connect your flag apology with firebase you can watch my video you will find the link in the description and you will find also the source code link in the description below so let's start our tutorial and first of all we need to add two dependencies of firebase core and firebase database so to get the dependencies open up your browser and type and from here we will first search for firebase database and open this first one and go to the installing tab and from here simply copy this dependency go back to your project open your prospect.dma file and below this copertino icons paste this firebase database dependency and again go to your browser now search for firebase code and open this first one go to the installing simply copy this firebase code dependency go back to your project and paste it here and now open up your terminal first let me say okay so we need to run letter for get so it will get the dependencies okay so we need now we will close this terminal and close this file and in the main in your main file main dot our file you need to initialize your flutter sorry uh your firebase so make this main method async and let me zoom it first of all we need to add widgets okay um widgets letter binding dot ensure initialized so it will ensure all the initialization and now we will add firebase sorry firebase dot initialize air okay and we have successfully initialized the firebase and power letter project now i will close this file and i will go to the insert data screen and here as you can see here we have some code here for text field and you will find the source code link in the description below okay so this is our button and inside this on press we will insert our data but first we need to create a firebase database reference here so simply type here for database reference and we will uh make it led so simply type database database reference and i will call it bb db ref okay and we will initialize it inside this unit state so db is equal to database sorry okay and we have initialized our data and as you can see here uh we i have already created three controllers for text editing controller and i am passing this text editing controller to each text field for user name for user edge and for user salary and you will use this controller for getting the text value i will go to the on press of material button and here i will create a map of data so simply type name and it will be the type of string for the word we'll use string here and i will name it students students okay sorry for spelling students and a recurring place and first of all we need to get a name so use the name controller username controller dot text it will get the text from the text field of username name and type h this will be the key and this will be the value user edge controller dot text and the last one is selling user salary dot text okay so now what we will do we will insert this web in our database okay so i will call dbraf push we are using push uh method here to create a unique uh key on every entry and we will simply set the data here and pass this to them map here okay so um okay uh let me open my mobile screen here and now as you can see here this is our inserting screen and if i go to the insert data okay and now firebase f has been created here we need to okay but we need to close the app and we will run it again so it will initialize your firebase running the body okay guys so our application is launched and i will go to the insert data okay here i will type name so as you can see the record is inserted here and we are using the push method so here it generates the unique key here on the start of node okay and let me insert another value okay so as you can see here another video is inserted in database okay so that's it for this video guys and this is how you can insert data in your firebase database or using clutter and you will find the source code link in the description so if you need this source code so you can go to that link and you can copy yes this source code and in the next video i will show you how we can fetch this data from firebase real-time database
Info
Channel: CodingZest
Views: 21,120
Rating: undefined out of 5
Keywords: CodingZest, how to insert data in firebase realtime database flutter, how to add data in firebase realtime database flutter, insert data in firebase database flutter, inserting data in firebase flutter, how to add data in firebase database, inserting data in firebase database, flutter firebase tutorial, flutter firebase crud app, flutter firebase database crud, flutter firebase database tutorial, flutter firebase database, flutter tutorial
Id: 8kUx9TFhXpQ
Channel Id: undefined
Length: 7min 36sec (456 seconds)
Published: Sat Jul 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.