Widget lifecycle — Flutter!

Stateful Widget Lifecycle

1. createState()

class HomePage extends StatefulWidget {HomePage({Key key}) : super(key: key);@override
_HomePageState createState() => _HomePageState();
}

2. initState()

@override
initState() {
super.initState();
// TO DO
}

3. didChangeDependencies()

@override
void didChangeDependencies() {
super.didChangeDependencies();
}

4. build()

@override
Widget build(BuildContext context) {
return Container();
}

5. didUpdateWidget(Widget oldWidget)

@override
void didUpdateWidget(covariant CurrentClass oldWidget) {
// TODO: implement didUpdateWidget
super.didUpdateWidget(oldWidget);
}

6. setState()

void function(){
setState(() {});
}

7. deactivate()

@override
void deactivate() {
super.deactivate();
}

8. dispose()

@override
void dispose() {
super.dispose();
}
void function() {
if (mounted) setState(() {});
}

Don’t forget to connect with me on:

Don’t stop, until you are breathing!💙
- Abhishek Doshi

--

--

--

Google Developer Expert — Dart, Flutter & Firebase 💙💛

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Run Refinitiv Real-Time SDK C/C++ Warm Standby Examples

Top Tools to Recover Data From an HFS+ Drive

Custom Analog Clock using Custom View Android

An overview of manaable: Admin Panel

manaable admin panel view with all features on same page

My KringleCon 2020 HolidayHack Writeup

Cloud Deep Dive: Part 2 — Serverless Stock Service

😍You only need at least 8 HOURS per day to keep your nodes RUNNING for the CONFIRMATION of your…

Genesys Cloud Chat Transcribe

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhishek Doshi

Abhishek Doshi

Google Developer Expert — Dart, Flutter & Firebase 💙💛

More from Medium

Flutter — Universal Drawer

How to pass data across the screen in a flutter app.

Building a Calorie Tracker App in Flutter!