Flutter State Management: Going from setState to Freezed & StateNotifier with Provider

Andrea Bizzotto • February 1, 2021
Video Thumbnail
Andrea Bizzotto Logo

Andrea Bizzotto

@codewithandrea

About

Tutorials about learning Flutter. Subscribe for regular videos covering all things Flutter, including state management, layouts, testing, and more. About me: I'm Andrea, and I created this channel to help you become a better Flutter developer. You can find more Flutter tutorials beyond my YouTube channel: Website: https://codewithandrea.com/ GitHub: https://github.com/bizz84 Flutter & Firebase Udemy Course (discount code included): https://nnbd.me/flutter-firebase

Video Description

Mixing UI and logic inside Flutter widgets is bad. Here's how to refactor a simple app for better separation of concerns, immutability, and type safety using Freezed & State Notifier. Written tutorial here: 👇👇 https://codewithandrea.com/videos/flutter-state-management-setstate-freezed-state-notifier-provider/ As a bonus, here's a movie app built to compare Provider, flutter_bloc and Riverpod: https://github.com/bizz84/movie_app_state_management_flutter CONTENTS: 00:00 - Intro 02:03 - Example Starter Project: Create Profile Page with setState 05:59 - ChangeNotifier implementation and its drawbacks 12:07 - Freezed package 15:47 - StateNotifier 16:55 - Using Freezed + StateNotifier + Provider 20:24 - Wrap Up 21:53 - Movie app on GitHub Join my FREE email course to become a Flutter expert with the best resources, at your own pace: https://codewithandrea.com/newsletter/ Want more? Check out all my Flutter courses: 👇👇 https://codewithandrea.com/courses/ Happy coding!

Boost Flutter Dev Setup

AI-recommended products based on this video

Loading...
INIU 45W Power Bank, Ultra Small 10000mAh Portable Charger, USB C in&Out Fast Charging Battery Pack, Travel External Phone Powerbank Compatible with iPhone 16 15 Samsung S25 S24 Google Pixel iPad etc

INIU 45W Power Bank, Ultra Small 10000mAh Portable Charger, USB C in&Out Fast Charging Battery Pack, Travel External Phone Powerbank Compatible with iPhone 16 15 Samsung S25 S24 Google Pixel iPad etc

(520)
$41.42
PrimeFREE delivery Sat, Jun 14
500+ bought in past month
Loading...
Car Carplay Woven Cable for iPhone 16 15 3.3FT USB A to USB C 3.2 Gen 2 Carplay Adapter Wire for iPhone 16 15 Pro Max, iPad Pro/Air, Samsung Galaxy S25/S24/S23/S22/S21 Google Pixel, Car Charger Cable

Car Carplay Woven Cable for iPhone 16 15 3.3FT USB A to USB C 3.2 Gen 2 Carplay Adapter Wire for iPhone 16 15 Pro Max, iPad Pro/Air, Samsung Galaxy S25/S24/S23/S22/S21 Google Pixel, Car Charger Cable

(213)
$12.99
FREE delivery Sat, Jun 14 on your first order
100+ bought in past month
Loading...
Google Pixel Buds Pro 2 - Noise Canceling Earbuds - Up to 31 Hour Battery Life with Charging Case - Bluetooth Headphones - Compatible with Android - Hazel

Google Pixel Buds Pro 2 - Noise Canceling Earbuds - Up to 31 Hour Battery Life with Charging Case - Bluetooth Headphones - Compatible with Android - Hazel

(183)
199.99
PrimeFREE delivery Saturday, June 14
400+ bought in past month
Loading...
MOSISO Laptop Case 13 inch, 13 inch Laptop Sleeve Bag Compatible with MacBook Air 13 M4 M3 M2 M1 2025-2018 / Pro 13 M2 M1 2025-2016, Neoprene Computer Sleeve Bag with Small Case, Space Gray Global Recycled Standard

MOSISO Laptop Case 13 inch, 13 inch Laptop Sleeve Bag Compatible with MacBook Air 13 M4 M3 M2 M1 2025-2018 / Pro 13 M2 M1 2025-2016, Neoprene Computer Sleeve Bag with Small Case, Space Gray Global Recycled Standard

(20,392)
$24.29$21.88
FREE delivery Sun, Aug 10 on your first order
Loading...
MOSISO Compatible with MacBook Air 13 inch Case 2021, 2020-2018 Release A2337 M1 A2179 A1932, Plastic Hard Shell&Keyboard Cover&Screen Film&Storage Bag for MacBook Air 13.3 inch Case, Crystal Clear

MOSISO Compatible with MacBook Air 13 inch Case 2021, 2020-2018 Release A2337 M1 A2179 A1932, Plastic Hard Shell&Keyboard Cover&Screen Film&Storage Bag for MacBook Air 13.3 inch Case, Crystal Clear

(2,431)
$14.52
FREE delivery Sat, Jun 14 on your first order
200+ bought in past month
Loading...
tomtoc 360° Protective Laptop Sleeve for 13-inch New MacBook Air M4/A3240 2025, M3/A3113, M2/A2681 M1/A2337 A2179 A1932, 13-inch MacBook Pro M2/A2686 M1/A2338, Water-Resistant Computer Case Bag Global Recycled Standard

tomtoc 360° Protective Laptop Sleeve for 13-inch New MacBook Air M4/A3240 2025, M3/A3113, M2/A2681 M1/A2337 A2179 A1932, 13-inch MacBook Pro M2/A2686 M1/A2338, Water-Resistant Computer Case Bag Global Recycled Standard

(12,952)
$36.07
PrimeFREE delivery Sat, Jun 14
100+ bought in past month
Loading...
MOSISO 13-14 inch Laptop Case, 13.3 inch Puffy Laptop Sleeve Compatible with MacBook Air 13 13.6 M4 M3 M2 M1/Pro 13/Pro 14,HP,Dell,ASUS, Lenovo, Polyester Horizontal Bag with Small Case, Rose Red Global Recycled Standard

MOSISO 13-14 inch Laptop Case, 13.3 inch Puffy Laptop Sleeve Compatible with MacBook Air 13 13.6 M4 M3 M2 M1/Pro 13/Pro 14,HP,Dell,ASUS, Lenovo, Polyester Horizontal Bag with Small Case, Rose Red Global Recycled Standard

(918)
$31.04
FREE delivery Tue, Jun 17 on your first order
Loading...
Syntech USB C to USB Adapter Pack of 2 USB C Male to USB3 Female Adapter Compatible with MacBook Pro 2021 iMac iPad Mini 6/Pro MacBook Air 2020 and Other Type C or Thunderbolt 4/3 Devices Space Grey

Syntech USB C to USB Adapter Pack of 2 USB C Male to USB3 Female Adapter Compatible with MacBook Pro 2021 iMac iPad Mini 6/Pro MacBook Air 2020 and Other Type C or Thunderbolt 4/3 Devices Space Grey

(144,783)
$10.99
FREE delivery Sat, Jun 14 on your first order
1K+ bought in past month
Loading...
ProCase Smart Case for iPad mini 7 A17 Pro 2024/ Mini 6 2021 8.3 Inch, Hard Back Cover for iPad mini 8.3" 7th Gen A2995/A2996/A2993/6th Gen A2567 A2568 A2569 -Navy

ProCase Smart Case for iPad mini 7 A17 Pro 2024/ Mini 6 2021 8.3 Inch, Hard Back Cover for iPad mini 8.3" 7th Gen A2995/A2996/A2993/6th Gen A2567 A2568 A2569 -Navy

(7,456)
$13.99
FREE delivery Sun, Aug 10 on your first order
100+ bought in past month
Loading...
ProCase Smart Case for iPad mini 7 A17 Pro 2024/ Mini 6 2021 8.3 Inch, Hard Back Cover for iPad mini 8.3" 7th Gen A2995/A2996/A2993/6th Gen A2567 A2568 A2569 -Black

ProCase Smart Case for iPad mini 7 A17 Pro 2024/ Mini 6 2021 8.3 Inch, Hard Back Cover for iPad mini 8.3" 7th Gen A2995/A2996/A2993/6th Gen A2567 A2568 A2569 -Black

(7,456)
$13.99
FREE delivery Sun, Aug 10 on your first order
100+ bought in past month
Loading...
140W C to C Super Fast Charger,Compatible with MacBook Pro 16, 15, 14, 13 Inch, MacBook Air 13 Inch, iPad Pro 2021/2020/2019/2018, Lenovo and All Type C Devices 7.2ft

140W C to C Super Fast Charger,Compatible with MacBook Pro 16, 15, 14, 13 Inch, MacBook Air 13 Inch, iPad Pro 2021/2020/2019/2018, Lenovo and All Type C Devices 7.2ft

(1,273)
$28.49
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black
Best Seller

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

(17,871)
$27.98$22.38
FREE delivery Tue, Oct 14 on your first order
500+ bought in past month
Loading...
Logitech G305 LIGHTSPEED Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

Logitech G305 LIGHTSPEED Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

(21,223)
$44.98
FREE delivery Tue, Oct 14
1K+ bought in past month
Loading...
Cmokifuly GMK67 65% Mechanical Keyboard Kit Tri-Mode South-Facing RGB LED for 3/5pin Switches,66 Keys+1 Knob Hotswap Socket PCB Gasket Mounted Plate Gaming DIY Keyboard Kit (White)

Cmokifuly GMK67 65% Mechanical Keyboard Kit Tri-Mode South-Facing RGB LED for 3/5pin Switches,66 Keys+1 Knob Hotswap Socket PCB Gasket Mounted Plate Gaming DIY Keyboard Kit (White)

(72)
$160.90
FREE delivery Aug 12 - 14Only 9 left in stock.
Loading...
5 Pcs Adult Keyboard Clicker Toys, Portable Mechanical Keyboard Keychain Toy, Decompression Toys, Funny Cube Key Button Stress Relief for Adults Present to Relief Pass Time

5 Pcs Adult Keyboard Clicker Toys, Portable Mechanical Keyboard Keychain Toy, Decompression Toys, Funny Cube Key Button Stress Relief for Adults Present to Relief Pass Time

(0)
$4.99
$9.99 delivery Jun 19 - Jul 3
Loading...
Asus ROG Azoth Wireless Mechanical Gaming Keyboard – 75% TKL, Tri-Mode Connectivity, Hot Swappable Pre-lubed ROG NX Snow Linear Switches, PBT Keycaps, RGB, OLED Display, PC/Mac Support - Black

Asus ROG Azoth Wireless Mechanical Gaming Keyboard – 75% TKL, Tri-Mode Connectivity, Hot Swappable Pre-lubed ROG NX Snow Linear Switches, PBT Keycaps, RGB, OLED Display, PC/Mac Support - Black

(1,146)
$229.99
FREE delivery Sat, Jan 3
50+ bought in past month
Loading...
TMKB 60% Mechanical Gaming Keyboard, Brown Tactile Switch, LED Backlight, Anti-Ghosting, Detachable USB-C, Double-Shot Keycaps, 61 Keys, Wired, White

TMKB 60% Mechanical Gaming Keyboard, Brown Tactile Switch, LED Backlight, Anti-Ghosting, Detachable USB-C, Double-Shot Keycaps, 61 Keys, Wired, White

(35)
$39.99
PrimeFREE delivery Sat, Jun 14
Loading...
UGREEN Revodok USB C Hub, 5-in-1 USB C Adapter with 4K HDMI, 100W Power Delivery, 3 USB A Data Ports, Multiport USB Hub for MacBook Pro/Air, iPad Pro, Surface, XPS, Thinkpad, Galaxy and More, Gray
Best Seller

UGREEN Revodok USB C Hub, 5-in-1 USB C Adapter with 4K HDMI, 100W Power Delivery, 3 USB A Data Ports, Multiport USB Hub for MacBook Pro/Air, iPad Pro, Surface, XPS, Thinkpad, Galaxy and More, Gray

(17,667)
$19.99
3K+ bought in past month
Loading...
SAMSUNG EVO Select Micro SD-Memory-Card + Adapter, 128GB microSDXC 160MB/s Full HD & 4K UHD, UHS-I, U3, A2, V30, for Android Smartphones, Tablets, Nintendo-Switch (MB-ME128SA/AM) [Canada Version]

SAMSUNG EVO Select Micro SD-Memory-Card + Adapter, 128GB microSDXC 160MB/s Full HD & 4K UHD, UHS-I, U3, A2, V30, for Android Smartphones, Tablets, Nintendo-Switch (MB-ME128SA/AM) [Canada Version]

(12,472)
$19.99$18.59
FREE delivery Sun, Aug 10 on your first order
400+ bought in past month
Loading...
Samsung EVO Select Micro SD Memory Card + Adapter, 256GB microSDXC 160MB/s Full HD & 4K UHD, UHS-I, U3, A2, V30, for Android Smartphones, Tablets, Nintendo-Switch (MB-ME256SA/AM) [Canada Version]

Samsung EVO Select Micro SD Memory Card + Adapter, 256GB microSDXC 160MB/s Full HD & 4K UHD, UHS-I, U3, A2, V30, for Android Smartphones, Tablets, Nintendo-Switch (MB-ME256SA/AM) [Canada Version]

(11,340)
$34.99
FREE delivery Sat, Jun 14 on your first order
200+ bought in past month