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
Dr Disrespect
5 hours ago🔴LIVE - DR DISRESPECT - ARC RAIDERS - SKILL TREE EXPERT
2,483 watching -
19:05
Cash Jordan
5 hours agoIllegals “DISMANTLE” LA Gated Mansions... Millionaires HOMELESS as Looters Take REPARATIONS
6.42K59 -
5:49
Buddy Brown
4 hours ago $0.64 earnedI Tried to WARN YOU Congress Would SNEAK It In! | Buddy Brown
2.49K8 -
LIVE
The Tom Renz Show
1 hour agoSusie Wiles vs Vanity Fair vs Truth
192 watching -
LIVE
Film Threat
23 hours agoFUNERAL FOR A FRANCHISE: STAR TREK - A SPECIAL GLOBAL EVENT | Film Threat Live
176 watching -
1:02:04
Jeff Ahern
2 hours agoNever Woke Wednesday!
2.11K3 -
44:30
DeVory Darkins
4 hours agoIlhan Omar dealt MAJOR BLOW after CNN host catches her in a lie
165K83 -
1:01:47
Timcast
4 hours agoTrump Orders "Complete Blockade" of Venezuela, Potential Act of WAR
152K126 -
2:53:04
Steven Crowder
7 hours agoVanity Fair's Susie Wiles Hit Piece: Who's To Blame PLUS Special Guest Jillian Michaels
515K746 -
12:52
The Kevin Trudeau Show Limitless
6 hours agoBeyond Good And Bad: The Hidden Reality Code
5.78K4