Lifecycle Flutter

 ///Note: As flutter is open-source, we can check the code and change it according to our needs.


///Stages Of App Lifecycle:
// The life cycle depends on the state and how it changes.
// A stateful widget has a state so we can clarify the life cycle of flutter dependent on it. Stage of the life cycle:
//
// createState()
//
// initState()
//
// didChangeDependencies()
//
// build()
//
// didUpdateWidget()
//
// setState()
//
// deactivate()
//
// dispose()

///Life Cycle of Flutter Widgets
///Stateless Widgets: The widgets which remain constant throughout the lifetime of the app are called stateless widgets.
// We use them when we want structures to stay the same all over the app, for example, the AppBar, color scheme,
// i.e. generally the User Interface(UI). These widgets are immutable, i.e. they cannot be changed.
// Here Hot Reload can reflect the changes made in the app structure and can be used for verification.
//
// Stateless widgets are just like a single block widget that cannot be planned.
// They can only be destroyed to create a new one with another set of widget configuration and properties.
//
// The life cycle of stateless widgets is simple; there’s only one stage: the build method.
// As soon as the widget gets built, the build method gets automatically called where you are supposed to create
// whatever appearance you want to add up in your application.
/// class MainPage extends StatelessWidget {
/// @override
/// Widget build(BuildContext context) {
/// return null;
/// }
/// }

///StatefulWidget lifecycle
//When a Flutter builds a StatefulWidget, it creates a State object.
// This object is where all the mutable state for that widget is held.
//
/// The concept of state is defined by two things:
//1. The data used by the widget might change.
//2. The data can't be read synchronously when the widget is built.
// (All state must be established by the time the build method is called).
//
/// The lifecycle has the following simplified steps:
//
// createState()
// mounted == true
// initState()
// didChangeDependencies()
// build()
// didUpdateWidget()
// setState()
// deactivate()
// dispose()
// mounted == false


///Architecture of flutter
// The flutter framework is a layered system with each layer dependent on the layer below.
// A single layer has several independent libraries.
/// On a high level, the flutter framework’s architecture has three main parts or layers:
// Embedder
// Engine
// Framework

///Framework layer :
// Foundation layer,
// Rendering layer,
// Widget layer

///A widget tree of "Hello world" :
// Root
// MaterialApp
// Homepage
// Scaffold: AppBar : Text
// Center : Text



//Architecture overview
// lifecycle -> app, stateful & stateless
// platform adaptations

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter