Flutter Tutorial - Inherited Widget Explained In Detail

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ต.ค. 2024

ความคิดเห็น • 49

  • @HeyFlutter
    @HeyFlutter  2 ปีที่แล้ว

    This might help you :)
    👉 12 Week Flutter Training from Newbie to Expert: heyflutter.com
    Source Code: github.com/JohannesMilke/inherited_widget_example
    BuildContext Tutorial: th-cam.com/video/ALmd6jLqUK8/w-d-xo.html
    Riverpod State Management Tutorial: th-cam.com/video/8H3bwxxla4Y/w-d-xo.html
    Provider State Management Tutorial: th-cam.com/video/kN9Yfd4fu04/w-d-xo.html
    Riverpod Calculator Tutorial: th-cam.com/video/6isW26d9TiE/w-d-xo.html
    Tinder App Tutorial: th-cam.com/video/v1wofhoutBk/w-d-xo.html
    Shop UI Tutorial: th-cam.com/video/CQZr-GXe__Y/w-d-xo.html
    Todo App Tutorial: th-cam.com/video/kN9Yfd4fu04/w-d-xo.html

  • @Ayush-bk3rv
    @Ayush-bk3rv ปีที่แล้ว +1

    Any doubt in flutter, you can count on this guy.
    Thank You

    • @HeyFlutter
      @HeyFlutter  ปีที่แล้ว

      Thanks, for your support, @user-im9wp8eo9s! 🙂

  • @chimurawill
    @chimurawill 2 ปีที่แล้ว +1

    I've been struggling to find an in-depth approach of inherited widget for days. Thank you so much for this video, awesome job!

    • @HeyFlutter
      @HeyFlutter  2 ปีที่แล้ว

      You are welcome, Willian Chimura 😊

  • @christianmarpert3844
    @christianmarpert3844 3 ปีที่แล้ว +6

    Awesome! Guess now I got what's going on under the hood of all these state management solutions. Although I keep going with one of them for simplicity reasons. Anyway, great explanation! Highly appreciated your contents. Keep goin and merry Xmas!

    • @HeyFlutter
      @HeyFlutter  2 ปีที่แล้ว

      Thanks! Merry Christmas 🎄 Yep totally fine to use Riverpod, Provider, etc. 👍
      Riverpod State Management Tutorial: th-cam.com/video/8H3bwxxla4Y/w-d-xo.html
      Provider State Management Tutorial: th-cam.com/video/kN9Yfd4fu04/w-d-xo.html

    • @christianmarpert3844
      @christianmarpert3844 2 ปีที่แล้ว

      @@HeyFlutter meanwhile I switched to bloc + get_it ;) just trying out different stuff

  • @fgreau
    @fgreau 11 หลายเดือนก่อน

    Thanks for the explaination !
    I'll admit that you writing "stfu" to use autocompletion to write StatefulWidget made be chuckle xD

    • @HeyFlutter
      @HeyFlutter  11 หลายเดือนก่อน

      Thank you, @fgreau! 🙂

  • @FelexAndVirginia
    @FelexAndVirginia 2 ปีที่แล้ว

    First of all thank you for this content bro here is question 06:30 when i add final String name; as varaiable on dependonMyinheritedWigetExactype() will i also change it to dependonMyinheritedWigetExactype().name ? 💁‍♀

  • @michaelrogers6935
    @michaelrogers6935 3 ปีที่แล้ว

    Instead of putting a StatefulWidget on top of the InheritedWidget, couldn't you have just extracted the counter into a separate class with an increment method?

  • @РоманСергеевич-э6ю
    @РоманСергеевич-э6ю 2 ปีที่แล้ว

    thx! great video!

    • @HeyFlutter
      @HeyFlutter  2 ปีที่แล้ว

      You are welcome, Роман Сергеевич!

  • @haiderjaafer8164
    @haiderjaafer8164 3 ปีที่แล้ว +1

    Absolutely brilliant keep going forward

  • @zledwon
    @zledwon 5 หลายเดือนก่อน

    Very well explained. Thanks! As a newcomer I have to say - clearly Flutter has big problem with state management. I know there are 3rd party packages, but c'mon.. there should be a better, clean way.

    • @HeyFlutter
      @HeyFlutter  5 หลายเดือนก่อน +1

      Right, @zledwon! 🙂

  • @KostasOreopoulos
    @KostasOreopoulos 6 หลายเดือนก่อน

    As far as I can tell, we are storing the state inside the InheritedWidget twice. Once from the Stateful widget, and one inside the InheritedWidget itself.
    The only time we use the state inside the InheritedWidget, is when we check between current and previous state inside updateShouldNotify.
    So what we do is keep two states in sync. When the stateful widget updates, it creates a new InheritedWidget which will trigger an updateshouldNotify, which will trigger a UI update.
    Is that correct?

    • @HeyFlutter
      @HeyFlutter  6 หลายเดือนก่อน

      Thank You @KostasOreopoulos! Follow this link: semaphoreci.com/blog/state-management-flutter-inheritedwidget-provider-state-management#:~:text=InheritedWidget%20is%20a%20tool%20for,the%20use%20of%20the%20context.
      I hope you will get your answer 🙂

  • @fluffycatstream6196
    @fluffycatstream6196 2 ปีที่แล้ว

    for those who can't access the counter, add .counter after Updating.of(context) after this. ex: final counter = Updating.of(context).counter;

  • @shaderone07
    @shaderone07 ปีที่แล้ว

    15 mins in ....I think i need to come back here later

    • @HeyFlutter
      @HeyFlutter  ปีที่แล้ว

      Great, Thank you @shaderone07!

  • @brokecoder
    @brokecoder 2 ปีที่แล้ว

    Dart seriously needs to DataClasses from python

  • @AnthonyDev
    @AnthonyDev 2 ปีที่แล้ว

    Great explanation. In depth. Thanks.

  • @elmagnificent8550
    @elmagnificent8550 2 ปีที่แล้ว

    good. bought ur sponsorship!

  • @dilshan3372
    @dilshan3372 3 ปีที่แล้ว

    Best explanation about inherited widget🤘👌

  • @hemantchauhan6437
    @hemantchauhan6437 ปีที่แล้ว

    Thank you✨️🙏

    • @HeyFlutter
      @HeyFlutter  ปีที่แล้ว

      You are welcome, @hemantchauhan6437 😊

  • @Dabayare
    @Dabayare 3 ปีที่แล้ว

    Most ppl nowadays are visual learners. So was wondering why they do not have the views and constrains tabs for Flutter development like in Java/Kotlin for Android Studio. They are very confusing building apps in the style of React when u have too many views.

    • @mrunfunny
      @mrunfunny 3 ปีที่แล้ว

      you don't really need it as you can instantly see the changes reflect in the emulator or an actual device

  • @eNONO-ot4zh
    @eNONO-ot4zh 3 ปีที่แล้ว

    thank Johannes
    my concern is probably linked to an inheritedWidget.
    the link to the source code does not work.
    like having the new link?

    • @HeyFlutter
      @HeyFlutter  2 ปีที่แล้ว

      Thanks, e.NONO! 🙂 This link should work for the source code: github.com/JohannesMilke/inherited_widget_example

  • @lyricsmint567
    @lyricsmint567 3 ปีที่แล้ว

    Awesome vid..

  • @moulikgupta6979
    @moulikgupta6979 ปีที่แล้ว

    oh my god you cant even imagine how much you helped me here....

    • @HeyFlutter
      @HeyFlutter  ปีที่แล้ว +1

      Glad it was helpful, @moulikgupta6979 😀

  • @anchorrealtynm7897
    @anchorrealtynm7897 2 ปีที่แล้ว

    Thank you for this, head and shoulders above other Inherited widget info.

    • @HeyFlutter
      @HeyFlutter  2 ปีที่แล้ว

      You are welcome, AnchorRealtyNM!

  • @insightsOfJ
    @insightsOfJ ปีที่แล้ว

    Thank you for the good video.
    As a note: so if I am correct, a drawback of InheritedWidget is, if your InheritedWidget is not above your MaterialApp and you push a page, then the children widgets will not be able to access the state variables of the InheritedWidget anymore. But if you put it above the MaterialApp then all ancestors and children will be able to access the state variables in the InheritedWidget. So how does one go about fixing the problem when a page is pushed and the InheritedWidget's state becomes inaccessible, because I am guessing this is due to the Navigator?

    • @HeyFlutter
      @HeyFlutter  ปีที่แล้ว +1

      Thank You J Richards! Follow this link: medium.flutterdevs.com/inherited-widget-in-flutter-604b0f009297#:~:text=In%20flutter%2C%20the%20inherited%20widget,references%20when%20a%20change%20occurs.
      I hope you will get your answer 🙂

    • @insightsOfJ
      @insightsOfJ ปีที่แล้ว

      @@HeyFlutter thank you Johannes!

  • @yoapps137
    @yoapps137 3 ปีที่แล้ว

    Really well explained... But if I feel more comfortable just using provider than this... Will I be missing out on something??

    • @yoapps137
      @yoapps137 3 ปีที่แล้ว

      @@HeyFlutter I actually agree with that logic. I too believe first learn to code those basics.. Then pick up on packages, lib.. Etc etc.. Hey by the way wrote you a email.. Hope you were able to read it.

    • @HeyFlutter
      @HeyFlutter  2 ปีที่แล้ว

      Most state managements make use of the InheritedWidget, also the Provider. The Provider is only wrapping the InheritedWidget and has some more features for more comfortable usage.
      Therefore it is always good to learn the basics of the InheritedWidget because it is used almost everywhere under the hood.

  • @fethisert5527
    @fethisert5527 2 ปีที่แล้ว

    Thanks bro it's very helpful to understand inheritedWidet

    • @HeyFlutter
      @HeyFlutter  2 ปีที่แล้ว +1

      Glad I could be of help, Thank you fethi sert! 😊

    • @fethisert5527
      @fethisert5527 2 ปีที่แล้ว

      @@HeyFlutter I want to ask something what is deference between initilazing variable in InitState() and intiliazing normaly like under the Class

    • @fethisert5527
      @fethisert5527 2 ปีที่แล้ว

      class Number extends StlsW{
      int x = GetNumber()
      }
      //or
      late int x;
      initState(){
      x = GetNumber();
      }

    • @fethisert5527
      @fethisert5527 2 ปีที่แล้ว

      @@HeyFlutter Yes you are very good but fast : )