Premium Only Content
Flutter State Management using InheritedWidget for Journal App
In this Flutter video, you are going to take a look at how to use the InheritedWidget for State Management - No Packages.
• How to use InheritedWidget to pass data from a parent (ancestor) widget to child (descendant) widgets in the widget tree
The Problem:
- Journal app has a mood selector value to be available to all pages.
- All pages need to read selected mood from the parent page.
The Solution:
- Use the InheritedWidget to allow child pages (widgets) to access the parent page selected mood by going up the widget tree.
The InheritedWidget is immutable and allows child widgets to access data (state) above in the widget tree
1. Create a class that extends InheritedWidget
2. Add fields to contain data
3. Add the of() method to access the InheritedWidget from child widgets
4. Add the updateShouldNotify() method to notify (via Flutter framework) widgets to rebuild if the data changed
How it Works:
- InheritedWidget – The InheritedWidget is great to pass data from an ancestor widget to descendent widget. The InheritedWidget is immutable and the data (attributes) are final (cannot change) and the Flutter framework rebuilds the InheritedWidget to refresh with new data.
GitHub: https://github.com/JediPixels/journal_inheritedwidget
Twitter: https://twitter.com/JediPixels
Looking for Updates: https://JediPixels.dev
Blog Article:https://jedipixels.dev/flutter-state-management-using-inheritedwidget-for-journal-app
#flutter #fluttertutorial #dart
-
LIVE
Reidboyy
13 hours ago24/7 BO7 Camo Grind! Stream Doesn't End Until I Unlock EVERY Camo in Black Ops 7!
40 watching -
23:46
iCkEdMeL
2 hours ago $1.18 earned🔴 Anna Kepner Case: 3AM Warning and Cabin Screaming Reveal Terrifying Timeline
2.36K1 -
LIVE
HomieQuest
4 hours agoLive Streaming!
94 watching -
26:47
Degenerate Jay
5 hours ago $2.51 earnedPlaying Fallout 3 For The First Time Ever - Here's My Thoughts
12.6K4 -
LIVE
ItsMossy
2 hours ago🍃DEVS ARE CRACKING DOWN🍃maybe a video?🍃shrooms aren't real dude🍃ARC RAIDERS RAIDERING SO HARD🍃
37 watching -
59:25
Jeff Ahern
4 hours ago $9.74 earnedThe Saturday Show with Jeff Ahern
75.7K17 -
29:53
Afshin Rattansi's Going Underground
2 days agoBRICS MUST Replace the US’ Authoritarian International Financial System! (Prof. Steve Keen)
10.3K17 -
31:27
Robbi On The Record
3 days ago $11.40 earnedWhat the Bible say about Astrology.. The Conversation Culture Has Been Avoiding | ft. JT Follows JC
44.9K12 -
17:38
Professor Nez
4 hours ago🚨THIS IS A NATIONAL SECURITY EMERGENCY: Stephen Miller with CHILLING WARNING for AMERICA
44.2K122 -
LIVE
tminnzy
3 hours agoBLACK OPS 7 MULTIPLAYER ROAD TO MASTER PRESTIGE
83 watching