 hello guys in the last video we have seen how to implement the qubit with a simple example now in this video we are going to implement the block with the respect to same example so let's quickly rename this qubit to block save this go to home page and change this qubit to block now let's quickly create a folder for holding the block files and the way we have created states and qubit same way we have to create blocks let me give it a name users underscore block dot dot and let's create one more file users underscore block underscore states dot dot so in addition to states and block we must have to work with events in case of blocks so that is why I need to create one more file that is users underscore block underscore events dot dot okay so first of all I will follow this qubit thing so that you can relate everything let's go here and copy this and paste it over there in the states and quickly change this to block users loading and change this to block users state let's change this to block user states and change this qubit to block and change this and let's import this as well okay fine so with this we have created these states in block okay so let's go to this qubit part and we can do what let's do it later first of all we need to create events as well in case of block so I will do what I will just copy this thing come back over here and paste it over here so here we have to create the event so for that let's create this journal class that is block users event fine so this class would be extended why whatever class we are creating at the event so in case of block we have to work with events and in order to work with the events we have to create events as well so let's create a couple of events first so I will just create a simple example I will say block users loading or you can say let's say initial event this would be the initial event same way we can create one more event over here that is let's say get users event so we don't need anything and this okay so these events are just required in order to interact with block fine so I just have created two events only so based on your requirement in future you can create more than this okay so let's keep it simple two events that is initial event and get users events fine so now comes to this block in block what we have to do the way we have created the qubit same way we can just copy this code come back to the block paste it over here and instead of using users we have to say users block fine and instead of extending qubit we have to extend block and instead of passing this qubit states we have to pass two things over here event as well as state so event I will just copy from the journalize event class paste it event so make sure you will follow the sequence of event and state let's copy this paste it and import these classes import the block as well and here we need import of repository as well okay now here just change this to this and here instead of passing this we need to change this to another state that is let's go to the state and we have this loading state come back here and just change it to this now here there is a little variation we don't use these methods over here let's remove this and we can remove this and this this we will use it over here to give me some time for so far so here we have to define one on method this is doing what this is going to detect your events and based on that you can take some decisions if you want or if you want you can omit any of the state so let's do what let's put semicolon over here remove this arrow and create the body so here what we need to do we need to do this thing over here let's cut it and paste it let's import this model as well and since it is using a way we need to mark a sync that is fine now here once your data is loaded instead of emitting this qubit state we have to omit this user loader state go back here it is block user loader let's save this so with this we have done this work with the on now the thing is this is only going to detect any event if any event going to happen so here we need to fire an event fine so the event can be fired from UI side or wherever you want for the simplicity I will go just after this on method and I will simply fire one event over here so how do you add event that there is a method add enter now it is expecting one event let's go here and we have some events just use the first event that is initial one once it is detecting any of the event then it is going to do this thing let's use this like way and save this and now this block is done states is done events are already done so this is a simple example so I have created two events only and the same way we have created states so I just kept it same now we don't need this qubit let's delete this first of all now we will be able to see some errors on home page as well as on main page so let's go to main page and change this users qubit to users block same way this would be used over here come back over here remove this qubit and just change this to this save this and come back to this home page and here let's remove this qubit classes and come back here and instead of using users qubit I have to say users block and same way let me just change this to so this is inside blocks so we just need to go back fine save this and same way we need to import this sorry this should be the block states so let's copy it from here paste it over here and we need to import this fine now here the states will be changed as we are using the block so just copy this loading or you can just name it as loading state fine so it would be better to understand that these are the states fine I just renamed so that you can better understand to save this and quickly go to this and just change this to state and change this to state so now you can easily identify where we are passing state and where we are passing event let's go here and here what we need we need to pass state so it is checking for states I just copy this go back here paste it here the second state is go back here the second state is loaded state go back here and change it to loaded so rest of the things will remain same let's save it and just quickly restart okay so now you can see we are missing any problem let's run it again okay it's working fine so let's quickly restart again in order to see okay so it is working fine so we have done it with the block as well simply we have changed this to block block states and on your main again we have changed this to block block and come back we have created three files over here the first one is for block states the same way we have created in qubit and second one we have additional thing that is events so as we have to work with block we must have to play with events so I have created two events for simplicity you can create more than that and in block logic business logic we have done same thing like we have done in qubit first of all we have passed one state as a super constructor now here we have done what one additional thing we have created one own method which is able to handle the different events fine so it is going to detect the event and based on that you can also take some decision if you want I will show that in future videos for simplicity if any of the event occur it is going to do what it is going to get the data from API and then it is going to emit loaded state fine so this would only work if any event is fired as of now no event is fired that is why I have added one line of code to fire this initial event fine so once it is fired this code would be executed and it is going to provide you loader state back so on your home page you are already added the logic and that is going to work as it is so that is all for this video if you have any doubt do comment in the comment section otherwise like share and subscribe thank you