Giter VIP home page Giter VIP logo

currency_converter_app_flutter's Introduction

currency_converter

Read: https://medium.com/@hadiyaaamir222/lifecycle-of-a-stateful-widget-aece2d56c946 Watch: https://www.youtube.com/watch?v=_gIbneld-bw&ab_channel=FlutterCommunity

A new Flutter project.

// https://www.tcmb.gov.tr/kurlar/today.xml

StatefulWidget Lifecycle Overview

This guide provides a detailed overview of the lifecycle of a StatefulWidget in Flutter, from creation to disposal. Understanding these steps is crucial for effective Flutter development, particularly in managing resources and maintaining performance.

Table of Contents

1. Widget Creation

At this initial stage, the constructor of the widget is called. This is the phase where constants or final variables are initialized.

2. Initialization

The initState() method kicks in here. Set up the initial state, fetch initial data, and initialize any controllers or listeners necessary for the widget.

3. Call super.initState()

Within initState(), ensure to call super.initState() to execute the parent class's initialization procedures.

4. Perform Custom Initialization

Still in the initState(), perform any operations such as data fetching or setting up event listeners.

5. Widget Building

The build() method constructs the widget visually based on its current state. This method represents the widget in terms of simpler, often composite widgets.

6. Widget Updating

The widget updates when setState() is invoked due to events, interactions, or incoming data, causing the build() method to rerun and reflect state changes in the UI.

7. Widget Rebuilding

The widget continues to rebuild in response to state changes until it is deemed no longer needed.

8. Widget Removal

This step occurs when the widget is removed from the widget tree, such as when navigating away from a screen or it's no longer displayed by its parent.

9. Disposing

The dispose() method is called, marking the end of the widget's lifecycle. Here, clean up all resources like disposing controllers, detaching listeners, closing streams, and other necessary cleanup to prevent memory leaks.

10. Call super.dispose()

Finally, within the dispose() method, call super.dispose() to ensure that the base class's disposal mechanisms are executed.

Understanding and properly managing these lifecycle methods ensures efficient resource management and smooth user experiences in your Flutter applications.

currency_converter_app_flutter's People

Contributors

tauhid-hasan-dev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.