What was the whole point of the _textKey? I tested out by giving my DateTimeWidget a static key but it still refreshes when you click on it while I would expect it would only change the title and not the body?
Thanks for this explanation! I just want to ask you is it required to use a "key" with DateTimeWidget? As I know when we call "setState" in HomePage then the DateTimeWidget instance will rebuild in all cases because it is a child for HomePage, isn't that right?
thank u, but how do you know all of this information, i was reading document from flutter, but never see that in development title pls, share the way y learn it
I am confused, I thought the whole idea of inherited widget and creating a stateless custom text widget was so that when we need to update the custom widget we only rebuild it and not needing to rebuild the whole widget, I even tried using the Custom text widget without adding its key and it still works because the whole widget is been rebuilt when set state is called. Pleas help me understand the whole point.
during rebuilding tree Flutter first comparing widget type and then key of the DateTimeWidget so Flutter will know which exactly widget has changed. Flutter traverse app tree and replace old DateTimeWidget Element with new DateTimeWidget Element as key doesn't match in your case. But for example if will have one more DateTimeWidget with key that not changed(some const value), then this widget Element will not be deleted from flutter tree and this widget wouldn't be changed. Also that is why flutter has so good performance, reuse existing object without recreating them if not needed ) Also recommend to learn about flutter tree, after understanding it will be much easier to understand other flutter concepts
@@VandadNP getting the source saves a lot of time. i can edit the codes and try all edge cases on the other hand if we see the video and do the codes on IDE it's time consuming. so i request you to please upload. it may not take a lot of time to upload from your side bcz you have the codes. i tried to find the codes on your git i failed
What was the whole point of the _textKey? I tested out by giving my DateTimeWidget a static key but it still refreshes when you click on it while I would expect it would only change the title and not the body?
Great video. I'm learning a lot here. @9:35, I think what it means is that you *must* pass a function to setState, even if the function returns null.
Thanks for the info and good point 💙
@@VandadNP I think that assert statement was written before null safety was introduced to Dart.
Thanks a lot. I think if you incorporate some diagrams in your explanations that would be amazing.
If we have to use setState to redraw the UI anyways, whats the point of Inherited WIdget??
that's great
thank you so much
Thanks for this explanation!
I just want to ask you is it required to use a "key" with DateTimeWidget?
As I know when we call "setState" in HomePage then the DateTimeWidget instance will rebuild in all cases because it is a child for HomePage, isn't that right?
You could experiment by removing the key and seeing what happens. It's always good to change the code and see the result you get 🔥
Tried it will work without using key also. But if after removing key if we add const keyword in front of DateTimeWidget then it will not update.
@@riteshkumartiwari153 It does here. ;)
Thank you for this course! May I ask what software do you use to record the videos?
I didn't understood the point or whats going on!!
thank u, but how do you know all of this information, i was reading document from flutter, but never see that in development title
pls, share the way y learn it
Great.
Glad you liked this
Thank you♥️
You’re welcome 😊
Great
I am confused, I thought the whole idea of inherited widget and creating a stateless custom text widget was so that when we need to update the custom widget we only rebuild it and not needing to rebuild the whole widget, I even tried using the Custom text widget without adding its key and it still works because the whole widget is been rebuilt when set state is called. Pleas help me understand the whole point.
during rebuilding tree Flutter first comparing widget type and then key of the DateTimeWidget so Flutter will know which exactly widget has changed. Flutter traverse app tree and replace old DateTimeWidget Element with new DateTimeWidget Element as key doesn't match in your case. But for example if will have one more DateTimeWidget with key that not changed(some const value), then this widget Element will not be deleted from flutter tree and this widget wouldn't be changed.
Also that is why flutter has so good performance, reuse existing object without recreating them if not needed )
Also recommend to learn about flutter tree, after understanding it will be much easier to understand other flutter concepts
can you give the link of this repo on github please please 🙏 ?
Source Code?
I usually don't provide source code for small chapters. Are you stuck at a specific part or generally curious where the source code is?
@@VandadNP getting the source saves a lot of time. i can edit the codes and try all edge cases on the other hand if we see the video and do the codes on IDE it's time consuming. so i request you to please upload. it may not take a lot of time to upload from your side bcz you have the codes. i tried to find the codes on your git i failed