Flutter State Management using ChangeNotifier and AnimatedBuilder - No Packages

  Рет қаралды 2,025

JediPixels

JediPixels

Жыл бұрын

Dashboard using `ChangeNotifier` and `AnimatedBuilder`.
State Management by using built-in Flutter classes. No Packages.
What is covered
In this project, you are going to take a look at:
- How to use `ChangeNotifier` and `AnimatedBuilder` to selectively rebuild individual widgets for performance
- State Management with build-in classes, no packages
The Problem:
- Dashboard app needs to chart espresso, coffee, latte and total consumption
- Drawing each section bar, the chart needs to refresh independently for performance
The Solution:
- Use the `ChangeNotifier` and `AnimatedBuilder` to allow to selectively rebuild individual widgets for performance
ChangeNotifier and AnimatedBuilder
The `ChangeNotifier` and `AnimatedBuilder` allow to selectively rebuild individual widgets for performance
1. Create a class that extends `ChangeNotifier`
2. Add fields to contain data
3. Add methods to modify data and call the `notifyListeners()` method
4. Add the `AnimatedBuilder` widget in the widget tree to rebuild widgets selectively if the data changed
How it Works
`ChangeNotifier` and `ValueListenableBuilder` - The `ChangeNotifier` and `AnimatedBuilder` allow to selectively rebuild individual widgets for performance. Use fields to contain data defining them in the `ChangeNotifier`. Use methods to modify data and call the `notifyListeners()` method. Use the `AnimatedBuilder` widget in the widget tree to rebuild widgets selectively if the data changed.
GitHub: github.com/JediPixels/dashboa...
Twitter: / jedipixels
Looking for Updates: JediPixels.dev
Blog Article: jedipixels.dev/flutter-state-...
#flutter #fluttertutorial #dart #flutterdev #flutterdeveloper #appdevelopment

Пікірлер: 4
@joeyroman84
@joeyroman84 Жыл бұрын
Thank you for these 3 videos! I have been using BloC and Riverpod but have no idea what is going on in the background. At least with these methods I understand what it is I am doing. Streams next I am assuming? :D Are there any performance differences between Inherited/ValueNotifier/ChangeNotifier? Seems like they can all be used interchangeably.
@JediPixels
@JediPixels Жыл бұрын
Yes, I am planning using Streams for future videos. Like you said, they can be use interchangeably, it's a preference depending on the goal that you need to accomplish. With the projects I have worked on, I have not seen any serious difference in performance. What can effect the performance is the app's logic that runs the custom task before the changes are redrawn on the screen. Thanks you.
@prasantkumar7693
@prasantkumar7693 Жыл бұрын
Nice explanation and interesting research by you. Thank you
@JediPixels
@JediPixels Жыл бұрын
Thanks...
Introduction Who Am I as a Flutter Developer
1:57
JediPixels
Рет қаралды 276
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 46 МЛН
Beginning Flutter - Intermediate - Using Common Widgets
4:44
JediPixels
Рет қаралды 76 М.
Flutter Shorebird - Code Push for Android & iOS (With Felix Angelov)
1:13:34
Flutter State Management - The Grand Tour
14:07
Fireship
Рет қаралды 239 М.
Flutter Provider Simply Explained
9:08
Learn App Code
Рет қаралды 88 М.
Dart/Flutter Enums Explained in 5 Minutes!
4:52
Learn Flutter with Me
Рет қаралды 3,9 М.
Flutter's Rendering Pipeline
54:11
Google TechTalks
Рет қаралды 110 М.
low battery 🪫
0:10
dednahype
Рет қаралды 1,6 МЛН
Vision Pro наконец-то доработали! Но не Apple!
0:40
ÉЖИ АКСЁНОВ
Рет қаралды 50 М.
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 484 М.