Hive Offline Database in Flutter | Android & IOS | Rahul Agarwal | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Hive Offline Database in Flutter | Android & IOS

teacher avatar Rahul Agarwal, Flutter Developer & Trainer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Course Introduction


    • 2.

      Video 1 Get Started with Hive


    • 3.

      Video 2 Understanding Hive methods


    • 4.

      Video 3 Implementing CRUD


    • 5.

      Video 4 Concept of Type Adapters


    • 6.

      Video 5 Build a Todo application


    • 7.

      Video 6 Update and Delete Todo


  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Storing data locally and persisting between app launches is one of the fundamental concepts of any mobile app development process. Almost every app requires that you handle data — from storing customer information for a food delivery app, to the number of points scored in a game or a simple value to understand whether the user has turned on dark mode during their last visit.

Hive is a quick, lightweight, NoSQL database for flutter and dart applications. Hive is truly helpful if you need a straightforward key-value database without numerous relations and truly simple to utilize. It is an offline database(store data in local devices). It has no native dependencies (it runs on Flutter Web!) can be the ideal choice. Hive bolsters all stages upheld by Flutter.

We will explore the Hive DataBase With TypeAdapter In Flutter. We will also implement a demo program, create a todo app using hive packages, and use them in flutter applications.

Why Hive DataBase?:

  • It’s the most efficient database in terms of speed and performance compared to SQFlite and SharedPrefrences.

  • It provides a straightforward way to perform basic (CRUD) operations.


  • Cross-platform: since there are no native dependencies on pure Dart — mobile, desktop, browser.

  • High performance.

  • Built-in strong encryption.

  • NO native dependencies.

Meet Your Teacher

Teacher Profile Image

Rahul Agarwal

Flutter Developer & Trainer


Hello, I'm Rahul. I am skilled in building cross platform application using Flutter. I am freelance developer as well as conduct workshops to share my knowledge with the community.

See full profile

Level: Intermediate

Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Course Introduction: Again, a lot of database options in photo, but it's not necessary that we always want to store users. They think the server. There will be scenarios where we want to store the data locally AT user's device so that it will be faster and convenient way to retrieve that information. Once such example will be user's preference of dark mode or leitmotif, lot of aflame databases. But among them, I was HIV. Hiv is a lightweight key-value database which supports mobile desktop and web platform. We can save data from primitive types like strings, boolean, to complex custom objects. In this course, we will cover everything required to get started with HIV. We will understand concepts like how to perform crud operations, what that type adopters. And finally build a basic to-do application so that we can execute practically whatever we learned so far. Let's not waste any more time and rolling now, hope to see you in the courts. 2. Video 1 Get Started with Hive: Hi. In this module, we will be talking about something in you which is called HIV. So HIV is a quick, lightweight NoSQL database for Florida and dad application. Hiv is truly helpful if you need a straightforward key-value database without numerous relations and truly simple to utilize. It needs an offline, the Ws, which means it stores data in user's device rather than silver like Firebase. So when we need to access some data inside Firebase, then obviously we need internet connection. But HIV is stored in user's device. That means he can access it whenever you want, wherever you want. Not wherever because he had to access it in his device only. So that is a drawback because if the user login with wikis account in another device, so data wouldn't be synchronous. So obviously HIV is use for its own purposes and you will get to understand it step-by-step. Now, the question arises is why HIV database? First thing is, it's the most efficient database in terms of speed and performance compared to SQL flag and shared preference, they're also offline databases. So when compared to those with it is faster. The second benefit is it provides a straightforward way to perform the basic crud operations. So you don't have to learn a lot of things that syntax are very simple. And the third is, since there are no native dependencies on your data. So it can be easily used for mobile, desktop and browser. So high is supported by all the other platforms as well. So enough, I guess for the Curie, we should directly dive into trying this technology on our own. For that, Let's create a new flutter project. Go to the directory, then, bring out their command line and just create flood. Create data base. Okay. Now you can see that project has been created. Bring out VS Code and append up project here. Just append folder, hive, database, like this. Sum. Before sending it in debug mode, I would like to add that dependencies which are required. So the go to a Chrome browser. And here in the pub dot deaf first type. Then here, you need to just copy the dependencies. Now let's go and go to File and pasted. Second is HIV flatter. So it is required to implement the database in Florida. And before then you can also go and check out HIV documentation if you want. See here, here it's mentioned water that dependencies are o, how it's done. The same. I will explain you everything in a more simpler manner. And that third dependency is but provider. Then go and install it. Okay. Now that three dependencies are being installed. Ubuntu Main.jack. Make sure you have your emulator running and simply click on Start debugging. It will definitely take few minutes depending upon your system. As always. I would like to explain you why we use this part provider. So part provider is used to get that applications to location for storing data. That is, as I already mentioned, that that data will be stored in user's device. So we will store those data in that same location. Our Hive database project application, that is this Android application on iOS application will be installed. So just remember that. Now. Now, if you want, you can check out all the dependencies. Read Me section and know more about why we are using HIV. I will just wait for a few more seconds so that our project is running. Till then. I would also give you an example of vector v would use the Hive data with suppose in settings such as dark mode daddy, if you have used some activation gate is something called dark mode or night mode. So dose preference did is those user preferences. We can save it in say, users own device. That is, whether it's dark mode is true or false, are also what is the user's user ID? We can just do it in the Hive database so that it can be used easily. Numerous examples. But I guess more and more you will understand when we create projects. Right now our focus is just to make sure that we understand the basic concepts properly. As usual. Is taking a little bit more time. Didn't then I would like to show you the next step of our implementation. The next step is to initialize. So here, you can simply have to initialize hiding. In the section. That is, before our application is running. We have to make sure that our HIV code are being initialized. Okay? You can see our application is about to, about to be installed in our emulator. It always take a bit of time. Okay, See, project is ready. Now it's time we initialize HIV. So we have to go to main dot, dot in the main function, just make it a sink. Then as we know, if we want to initialize anything before the app is running, we have to write this line of code, widget, flip data binding got ensure initialized. Then second wouldn't have is that directly where data is being stored. Await, get application. Documents, directory like this. This comes from but provider. And this directory comes from that data IO. Now second, next step is to initialize HIV, hiv dot init and then backpack. And that bitewing be our directory dotplot. That's it. So in this way, initialization is done. Now the next thing I would, I would like to discuss is that concept of boxes. Hiv stores its data in boxes containing t value sets. Before you can read or compose data, a box should be opened. Boxes can we append with a weight, with just a basic syntax like HIV dot append box. All that data's stored in height is organized inboxes. So I will just give you an example. Suppose in our tables, that is, when we have a database, SQL database, there is a concept called pebbles. And when we were using Firebase, then we had the concept of collection. So leg that only you can compare a box. Just remember, a box does not have a structured and can contain anything. So you have to just remember that like that. And 40 real-world example, I will say a user's box or the settings box, are these sent messages box, if you want, you can create. Now, let's create our first box. So as I said before, you can use your books, you have to append it and also give it a name. Just simply understand it as a database name. This loads all its data from the local storage into main memory for immediate access. So here, if I go and write HIV, hiv dot append box, like this, I have just simply append their box. And after that, I'm running my application. Also, remember, it is not mandatory to append a box in the main file. You can do it anywhere. Just remember to append a file, this up into a box at the very beginning and after Let you can use it. And our app is also not showing any editor right now. So it's a good thing. Under plugins are working perfectly. So now let's create our first screen. Go to lib folder and create a file. Name it home screen, dot-dot-dot. Okay. Now import material. Then a stateful widget, name it home screen. Then as really Dennis scaffold, that AB bar. I would give it a text. Hive DB. Then in the body, Let's have a container. And that container, I would give it the width of the device width that this media query that off contexts that says that width. And shine. I would give it a column. Now, simply I would create a UI which will help us to understand that crud operations. Create, read, update, delete, do this column. I will give them access alignment S and desolate under widgets are been centered. Within that children. I will create elevated buttons, illuminated buttons. So first button will be 38. Then I will just copy it and paste it multiple times like this. And then second one, I really like read. I will write update and for unrelated. So now save it and go to main dot dot. And in my app widget, just remove everything below. Here is my homepage and we know we don't need them boilerplate codes. And inside the home property, I will write home screen, that is our own home screen, and then restart. Let's see. So our output is here. We have Alda for buttons. So definitely like any other database, there will be crud operations in HIV, which we will discuss in the upcoming videos. Thank you. 3. Video 2 Understanding Hive methods: So we have the IQR of the credit application ready. But before implementing all the functionalities, I would like to discuss and understand the HIV methods. Because theoretically also we should know what are the different, different functionalities Hive database gives us. So first is get up inbox. So in the last video, we have started or we have initialized a new box by their name off friend. So obviously, if we need if we need that box or the Ws in their later screens, whether it's detailed screens or wherever. So we don't have to append it again in, again in order to store or retrieve data. Hiv stores a reference to all append boxes. If we want to get them all ready, append box, we can use that below syntax. So here you can see var box is equal to HIV dot box and the box name, in our case, it will be box, namely befriend. So similarly, once a box is open, if we want, we can close a box as well. So if you don't need the box, again, you make lose it. I'll cast keys and values of the box will be dropped from memory. And that box file is closed. After our active read and write operations are finished. Also, remember it is perfectly fine to leave a box append folder, run the app. If you need a box again in the future, just leave it open. In simple words, suppose we have only one screen which will be using that box in front mission. At that screen, you can dispose it because that box is not used by other screens. But if that information is used application wise, it is in older pages are in most of the pages that I then I guess it's not advisable to close the box. Just remember, you have to close the box in that disposed my head office stateful widget. And the syntax is HIV dot close. Or if you want to close a particular box because HIV dot close will close on the boxes. But if you want to close only that friend walks, you can just directly write Bach HIV dot box, then the box name dot clues like that. Now, after the box is opened, we have do we have to insert data inside it? So if you need to store data, you can use the reference to the HIV box and put my 10 on it. This method accepts a key value pair. So here you can see Box dot output, and then key is name, and value is John. This is how we insert a data. Now, HIV also supports integer keys so that you can use auto-incrementing keys. In. This can be useful if you are storing multiple values kind of similar to a list and one to retrieve by their indexes. That is indices. You can store leg. This is, this is the syntax. You can directly reduce box dot and I laid person put. And now this is Add and it will store that value in that index starting from 0. So you can just see it like a map and a list. This is a very good example because HIV also use those datatypes. Laughter inserting data, we have to retrieve the data as well. To read data you can use that getMethod on the box object. You just have to provide the geeky for retrieving its value. Like var, name is we're going to do box dot, get and then name. And as you can see, name is the key of the data. So this is how you retrieve information from the Hive database. Now the next thing which is important is updating data. To update that data of a particular key, we can use the same PUT method that we originally used to store the value. This will update the present that key with the newly provided value. So I layer we use Box dot put name is John. Now we can directly use Box dot name is going to make. And that previous value will be overrided. Similarly, if you are using auto increment values, we can use that put at my 10 for a bidding their value present inside that particular index. You can see Box dot put at 0 position, Jennifer. So this is how we update data in a database. Another Last Mile, which is very important, is deleting data. For deleting the data, we can use the delete method by providing that key or delete admitted by providing that index. So it up to us what we are, how we are storing that data inside the hive box. If we are using that key value pair, then we can directly write Box Dot Delete and that key will be named. And if we are using index, then we can write it above. Start delete at 0 position. So this is that theory or does the next of that cred, that is how we can perform that cred. And as I say, HIV is very easy because you can see all the keywords are, the methods are just straightforward. Box dot get, Box dot, put, bogs, Dot, Delete. So these are not that complex thing to remember. So that's it. For this video. In the next video, we will implement Alda concepts that we understood here practically. Thank you. 4. Video 3 Implementing CRUD: Hi. So now we know all the concepts that are required for performing crud operations in HIV and have also built this really basic UI. For the same purpose. Let's implement HIV methods in our home screen. So go to Home Screen dot, dot. And here, let's create some variables. And the first thing I would do is get the append box. That is, get the reference of this box. So I will just name it. Friend box is equal to HIV. Hiv dot box and name it. And then name was friend. So we have to use the same name of the box. And after this, the second will be a string which can be null as well. And I will write the variable name is name. This, it will be the friend name, which is stored inside this box. Now let's create some methods like and friend. Make it synchronous. Then second method will be get friend. Third will be the friend and forth when we delete friend. Okay, so these are my pencil acquired. Now, what I want is when a, when we click on this create, this add friend is executed and a value is being stored in that box. So I will simply write a weight friend box dot put. So for inserting data we, I am using put because I will give it a key is when key will be name and where you will be Bill Gates. Okay? Now, we have done adding a friend. When a user clicks on this read, then I want this get friend to be executed. N, store this data inside. Then name variable. For that I have to write. Name is equal to friend box dot get, and that key will be named. So for the early as we discussed, we have to use that dot, get my tag. And what I will be doing is as soon as this variable is that data is being stored in this variable, I will set this state so that the UA is rendered and then name variable can be shown in that screen. Now for the update frame, I will simply write await friend box. Put inside that key name. I will write Elon Musk. That's it. But that's how we update. And simply for the ladle, so I will write a great friend Box Dot Delete, and key is named. So we mentioned that a key here at this add friend function. And after that, we were just using that key to either get devalue update or delete data value. So we have our functions Ready is time v. Make sure those are being executed by that Connect button. That is when we create the concrete, it should think should be executed. We add friend. Then. Second is get friend, which should be executed. When Redis click Update friend. Like this. And food is delete friend. So buttons are now connected with these functions. It's time. I will show it text at the very top, like text. And here simply named variable. Now let's restart and check if everything is working fine. R-naught, our Cloud application is ready to be tested. So see at the very beginning, Don name key has a null value. Now, if I click on that Create button, what should have pennies? The name Bill Gates should be stored in that name variable that is named key. Now if I click on read, that it must be updated with the name. Let's see. You can check. This is working perfectly. Bill Gates is there. Now, if I click on update, it should be changed to Elon Musk. If I click on it and then click on Read, see, Elon Musk is there. That means we'll get is being updated with Elon Musk. And finally, if I click on delete, this data is deleted and when I click on Read, it is again showing null. So this is how HIV crud operations work. And this database was installed in the user's device only. So that's it for this video. In the upcoming videos, we will be talking more about HIV and its other features. Thank you. 5. Video 4 Concept of Type Adapters: Welcome. In this session, we'll be talking about the concept of type adapters. Hiv permits us to store most standard types. That is string in digital map, least the tank. Now, when we're building real world application, we will have modal class for our data, since this makes development a lot simpler and quicker. The delays this model kinds we need to use type adapters, which causes are, which helps to encode and decode our data to binary form. On our desk. Type adapters can be written manually, are generated automatically. It's always better to use code generation to generate the required methods because it helps to prevent any mistake that might occur while building our writing that code manually. We will generate it by adding HIV generator and wilderness in that dev dependencies in Pub spec that YAML file. So bring out your Chrome. And here, simply write. This is, as you can see, Janet step editors adapters to store any class. Is copy. And go to Yemen. Sorry, inside dev dependencies like this. And second is build a runner. Simply copy it and install it in that dev dependencies. Remember, not interdependencies because this is just for the development purpose. Now, okay? We have the dependencies in stone. Now as I say, V might need modal class. So I would, I will be creating a to-do application from now on so that we can understand Hive database more properly as suppose those today's to-dos datas are not required to store in the server. Those are personal to the user's device only. Inside lib folder, simply create a file called todo dot, dot, dot. And here, let's create a class called to do. Then. It didn't have a title and has been completed or not. And this should be now create the constructor. And this dot-dot-dot. This is completed. So we have our modal class is ready. It's time we generate adapters for this class. The HIV genome package can automatically generate adapters for any class like this, our class. There are few steps for it. First step to generate it, type, their favorite class. I notate it with HIV Type and provide a type ID. Second step is an added all the fields. That is, these fields which should be stored with HIV filling and tireless run belt US debt is there is a command we have to use so that it will automatically build an adapter class for it. And the fourth step is to register that generated adapter. So. Let's start doing it. Let's start. I know they didn't die model class to use code generation. Simply. First thing we have to do is import. Then here we have today type and type ID, just give it one. Then within the fields we have failed and then index just 0. Then similarly here, hiv, index one. So in this way, our first two steps are done. That is an added the hive type and provide a type ID. And second is annotated alphas, which should be stored with high field. Now 30s. Third step is simply bring out your terminal and type. And before that, you have to write this code as well. But then inside it write the name of this class filing that this todo dot, dot, dot. So this will be automatically generated when we write this command that is bringing out the terminal and right Flutter packages and press Enter. Let's see if it is working or not. Because I don't know. We might have to stop debugging and restart. It will work directly because as we installed some new dependencies. Let's say this working, I guess something is showing in the console. See, it's done. Our adapter is being learned, or you can say it's being built automatically here, this todo dot, dot, dot. And remember, this is the adapter and we do not have to modify anything in init. And this dot g, g means generating as typically transform our Janet adapter for this class. So this is how we, how we use custom class data. And we make sure our how about a hive supports those classes as well. Here I am using this Todo class. Now finally, all the steps I've done, it's time we registered this adapter. So all these codes generate an adapter called todo adapter. Here you can go and see this adapter. And you should register this type adapter before opening the box. That is using either wise, it will produce an error. As we are just using a single box. And you can see I'm using this friend box. But right now I would like to first register the adapter here. And that with this code, which you can check it out, why it's not working. The register that Percy. And within that app that I would like, I would just write adapter Magnus. And after that, I will append a new box. Width. To do. That is this box will only contain two data. I will simply append box and name it. I will just write. Let's see. Let's save. And if no error is dead and it has worked properly. Okay? So we have successfully registered our adaptive as well. Now in this database that is to do box, all the data will be stored. Of this object is todo object earlier it was like key value, that is JSON format, that now it will be different. So that's it for this video. In the upcoming video, I will create a basic to-do application using flutter and HIV. Thank you. 6. Video 5 Build a Todo application: Hey, welcome back. So in the last video, we have successfully created the adapter for our Todo class. But now it's time to start working on the complete Todo application. Far that Let's go to that folder and create a new file and name it, add to-do dot dot. So basically, this screen will be used to add it to new solid. Obviously, when we have some data in the database, then only we can retrieve those to-do items. So first step is to make a screen so that a user can type his to-do item and then upload it to the fire base. As always, import a material package. Then a stateless screen. I will, I will create a name it at to do. Now make it return a scaffold then in the app, but just given bus so that I can have a back button. That's it. Now, in that body, my, my plan is to just keep it text field where the user will enter an a submit button, that's it. So I will start with depending because I know I need some spacing from all sides and give it to indeed this. Remember when you are building a lot of application, you know that a vastly from on-demand sites, you need some spacing. So that is why you can do it at the very beginning as well. Now in the child, I will have a column on column item should be centered. So I will make main exists alignment dot center. Then we wouldn't have our children's. Now, before I write what's inside Chamberlain, Let's go to the home screen. So that here we will have a floating action button, which when navigate to that add to screen. Also all the previous codes leg this which I just wrote to explain that cred operations. I would like to remove it because I don't want this in this to-do application. Now. Just have a floating action button and have a floating action button like this. Child will be. I can, I can add. And we didn't unphased. I would simply write navigator dot push material, page it out. That out we will have our context and add a screen like this. Save it. And in ambulatory can see I will just name it HIV. Do that title of the screen like this. Cave. Now if I click on it, see we have an empty screen and this is our back button. Now let's go to the Add to do screen. And we didn't that children. I would have if I would have a textbook, I would create a text editing controller. At first, intimate detail controller is equal to dx editing controller. Like this. And also, since we have already append our box in the main dot-dot-dot is this to-do box. I would just get that append box. So we just said box. Box is equal to. Hi, box. And name it blew. That is, its name was done. And it will be off to do data like this. Now, let's go that children, let's create our first text field. Controller will be title controller. Decoration will be in good curation. And just give labeled text as Pena. And as outlining put powder like this. Let's save it and check it out. See, we have our title text field after the deck. So I will give some spacing using size sparks, heightened, give 30. Then I would create a button with the container than height. I would give it 50. When I would give the device when that is double-dot infinity. When I would give it a liberated button. And within that text, I would just say add blue and give it some styling to that text. That is mainly the font size, which we'll be doing good. Let's save it and check it out. See the UI on the screen is okay. Now it's time. We work on the on press button so that whatever text is inside the steady controller, or you can also say whatever text the user has written will be stored. First of all, it will be converted to a todo object, that is this to do type. And then after it will be stored in the hive box. So simply press Function. I would first check if that item controller is not none dot txt not equal to NP, then execute that code. So first of all, I would create a new object. A new blue is equal to two, like this. And inside it. For the title, I would write detail controller dot text. And now for the East completed that the default value, we'll visit fonts. As it is a new to-do item. After this object is created, I would simply take that to-do box. That is the high Vaux and right dot, add and send and gave it this to-do value. As we have already done here, that type Todo class, it will only accept you do datatype. And this dot n means there will be no key. It will be stored in the index. That is, suppose it is a kind of a list, so it will be stored in the 0 index as there are no items. And after that, I would just pop out from the screen. That's it. Go and check it out. We click on this Add to do. And I would just simply write learned provider state management, okay? Like this. And click on Add to do. And see we have got navigated out. But we cannot see are we haven't retrieved the to-dos, so we can, we're not sure identity is being stored properly or not. So let's work on that retrieval as well. And the home screen will be responsible for displaying the data stored in height. Basically, we will implement the read operations here. Flattered, provide us a rigid called value listenable builder that only refreshes when any value inside that specified database or that collection is modified. Let's see. You will understand what I mean by that. First of all, I would create a box instance that is Toolbox is a call to HIV. Not box. And give it a data type. That's it. Now, in the body, I would write value listenable builder, this one. So it has two parameters. First one is valueless neighbor, that is which value it has to listen. And I would simply like to do that is this box dot listenable, but this listener been, my turn, is only available in high flutter package, so we have to import it, import HIV here third, and then high flutter like this and see the added is gone. So you have to remember that dot listenable is available in the high flatter package. So what does this code means? So in simple words, if anything changes in this to-do box, this widget will be rebuilt. Again, as simple as that. So just, you can also understand that if something changes set state will be called. This is a very limited example, but I just want you to understand the concept. The builder is a function which has first thing context. Second thing is a box, that is net to-do box. And third thing is a widget. Unless we are concerned with this talks parameter, we will use that only. The first, I would just check if box is empty. That is no do has been inserted. In that case is simply return. Just simply return a center visit. We take child. That is a text, new, Todo, like this. And suppose dark box is not empty. In that case, we would output a widget that is a ListView builder. And simply return a list view. Since it does stored in that HIV is in the form of a list. Now, item count will be Box dot length. That is this one, which is also means this box. But we will use this as we are listening to this builder. And in the item winder, We will hire contexts and index. Now inside that, since inside that blue box, our data. To do data type, that is todo object. I would just write it down in a variable. To do is use the box dot, get an index. Just imagine this index is 0. Within that box. It will go to the index 0 position and bring that to do data and storing it in. And it will just iterate it. It will just go on until the length is over. So simply write return list. And inside it. I would give it a title. In the title property, I would give that text of blue dot title, neck this Let's save it. Earlier we have written master, provide US state management. See, we have this learn. Provide estate management. And you might be asking why get is another two of them that is master state management in flirted and this so I would like to say this was because I have already tested the Hive database in this device. So that is why, because that miming was same of the box. That is to do it has fetched the previous data stored as rent. But suppose I would just write here, wake up early, suppose, and then add 2 and C. You can see that wake up early here. So ultimately, our to-do app is working till the head. So that's it for this video. In the next video, we would implement the update to do as very less delete to do functionalities. Thank you. 7. Video 6 Update and Delete Todo: So until now we have this basic to-do app. It's time v, implement something to indicate that this ToDo has been completed or is done, then only it will be removed. Are the user won't even know that this task has been done, are not far that I will be using. It checks the checkbox widget. And far that. Because in that checkbox, there is something called change. That is, if you click on it, we get a value of true or false. And according to that value, I would change the properties of this text region. So let's do it practically. Within that title. That I would show a leading icon. And it will have it check. Box value would be to do is converted is either true or false. On, within the onchange property. I have to do something so that the value inside this two will get updated. Now that being is, since I made this value final, so I cannot directly go and change the value that is value inside this Todo class, it will show an adder. So what I will do, I will create a new variable and simply write like this and this. And inside it, that title would be same as this study is to do the title that the previous one only but is completed will be this value. That is this one. And since it is in safety, I have to use this explanation so that I would make sure that this value is not null. Now and now. After this, I would just replace it with it. Put at index. And value would be new to do like this. That's it. So what it does, it, it, it simply creates a new to-do and replace it with the previous one. Now, as our little tool, I'm not updating this to do because its properties where final. You can also change the model class. That is, you can go and change it here and then again, rebuild it, rebuild this adapter now. But I am not doing it in a, I'm not trying to do that too. And just skating simply a new object and replacing it with the previous one. Now, suppose this value is two, that is, this task has been completed. Then I would show, I would do some changes to this text as well. So within that txt, first thing I would give a font size simply as 20. Then font-weight. Font-weight, bold. Now that color. So if two blue dot is completed is true, then I would write colors dark green. If not, I would add colors black. Let's check it out. If I click on it, see colored is becoming green. If I click on this, color is becoming green. Now what I would do is simply in that declaration, I would do to new dot is completed. If it's true, then write text decoration dotted-line, true. If not, I would add text decoration none. Let's see what does this code does? So if I click on it, see it is. Strikethrough. That is, we can understand that this task is completed. We don't have to think about it. So this is how our update to do works. Now it's time that we have a functionality to delete is to lose as well. For that, simply after the leading, I would have it trailing icon. And within this journaling, I would give it an icon. Button. Icon would be I can I can start the late color to colors darker red. And then pressed. See, unlike concern here. Now simply we have to delete. And we can just write in one line of code that is Box Dot Delete, ad and the index, that's it. So it foot delete that particular todo at that index. After that, I would like to show a snack bar. I like to give some feedback to the user sometime if you want, you can give this map body in other sections as one through six is like this. And that's it. Let's try it out. If I click on it, see it successfully. If I click this, it is also removed from the Hive database. And if I remove everything, then know to do ever since our boxes empty. So it is a very professional and a basic to-do application using flutter and height. Now everything is okay. Apart from this one, can, I suppose I add something like flooded? Okay. It is coming at the top. If I write mustard, Firebase 10 c, it is not coming at the very top, it is coming, it does second. So this shouldn't happen. Then let this one should be at the very top. So far that I just have to do a few changes in this list view dot builder here. First thing I would write this reverse is equal to true. And second thing, see if I click on this now and save it. That thing is reversed, but everything goes at the very top because the ListView takes all the available spaces. That's why if we don't use this property, does shrink wrap is equal to true? It will go at the bottom. But which shrink-wrap is true? List we only occupies the space it is needed. See, now it's looking very good. If I type something now like practice, provider, state, management, like this. And okay, C and the very top is being outputted, that it is being displayed properly at the career that is descending order of its upload data, you can just save. So that's it for this module. I hope you have enjoyed and learned a lot. Because when we are building any application using FERPA, It's not always necessary to use Server database. We might, and we will have many scenarios where we need Hive database, that is local storage, storage as well.