Callback functions in Flutter

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone welcome to my channel in this video I'm going to explain you flutter callback functions so in the flutter we are having two types of callback functions one is without data passing the that is called as white callback so with the helper we call your function uh we are unable to pass any data just we will get the triggering point so value Setter comes to the value Setter so through this call the function we are able to pass any type of data the district Boolean map list anything anything will be able to pass with the help of the value setter so in this video I'm going to explain you white callback void callback for example if you see uh if you see the elevated button if you see here first over I am taking on a state fluid get here adding body so it is a body so if you see here row children main exercise Max here I am taking one elevated button so if you see here related button submit okay so if you see this on press actually this is the Callback function on press so in elevator button this will get having inside on press function on press miss this is also one of the white callback function so similarly we are creating uh the Callback function we are customizing the Callback function this is in multiple if you see here regulated button this is the on press if you go this is the word called there also they they were using our white callback so similar way we are customizing the Callback function so for that one we are taking one we are taking one container color green I'm taking one more container okay okay so so this row inside the row uh this controller will take will take off portion this will take off portion for that purpose what I have to do next I will I have to wrap this container with expanded radical so this one also have to do same thing expanded now let's run the code and check how it is coming so if you see here so off of the portion is occupied both containers to the screen so inside this container green container I am adding one button foreign first page Dot SPL it okay first page inside the container I am taking child X elevated e ffort button s field will be text change name okay margin so I have to wrap this with Center we get container no need so container I am removing now here I have to pause callback function why callback fall back on press on button on button press it from here after that here the sound button press enter the Constructor which is required one button press so here what I have to do on button press so this will be on button press so I have to call this we get here so you can see here on button registered call package came here and here this would get so just print it first place button press it okay so here I am taking one texture idiot I text so initially I am adding one name string name who said after that I'm adding this name here so whenever when whenever the first button presses happen I want to change that name to Psy like that so after that I have to refresh the screen here okay done now let's run the code and check how to discover okay question is coming here but here uh this is red how to give okay it's okay first of all checking so change them when I click on this this name have to change change name see is coming and also first page button pressed first budget first page button is president but print also coming here this name also changes from Hussain to Psy commercial so like that we have to integrate the Callback functions and also and also I will explain new value Setter also so value Setter uh what is the difference between value Setter means validator and void callback we will pass any type of data with the help of Value Center callback function but if you take white callback we are unable to pass any type of data that is the main difference between these two so here what I am taking on bottom press so here over instead of white callback I am adding value setup so here I am passing some string string now this is expecting a string value so see here it is expecting string value callback function why because we added the value Setter inside the string so that's why so here I am passing um Muhammad okay so after that see here this is also getting some error because inside this function inside the inside this function we have to add one parameter value so so this callback function is returning now some value that's why we have to add the value here so after that print this value what it is coming okay and also here I am changing the name to Value so whatever the value we are getting I am assigning that value to the name so initially it will be displayed same whenever user click on the button then it will display Muhammad because we are passing the muhammadna Muhammad name we are passing through the Callback function validator for that workplace so let's run the code and check now if you see here now uh this one is displaying Hussain so when I click on this change name Muhammad is coming see like this way we have to pass any type of data with the help of value Setter function we don't want any data so in that case you will use word callback function white callback function like this so if you are using white callback you are unable to pass any type of data you have to remove the value and also here you have to remove the thank you so this is the complete detail information about the Callback functions in Twitter uh if you if you like this video or if the video is helpful to you please share to your friends uh this video will be made helpful to them
Info
Channel: Flutter Code Hub
Views: 264
Rating: undefined out of 5
Keywords: callback functions in flutter, flutter callback function, flutter callback, callback function dart, call back function in dart, flutter callback function with parameters, callback function in flutter, callback in flutter, flutter callback functions, flutter callbacks, flutter callback with parameters, flutter call function after build, flutter define callback function, callback function in flutter example, callback function with parameters flutter, flutter function callback
Id: R3J6pV5n8y4
Channel Id: undefined
Length: 12min 7sec (727 seconds)
Published: Fri Apr 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.