Flutter Tutorial - initState | setState | dispose | Timer | Stateful lifeCycle {الشرح بالعربي }

Опубликовано: 14 Июль 2026
на канале: Nour Ahmed
1,735
64

1. After calling createState() on the StatefulWidget, the framework inserts the new state object into the tree and then calls initState() on the state object.
2. A subclass of State can override initState to do work that needs to happen justonce.
3. When setState() is called on a State object, all descendent widgets rebuild. Therefore, localize the setState() call to the part of the subtree whose UI actually needs to change. Avoid calling setState() high up in the tree if the change is contained to a small part of the tree.
4. When a state object is no longer needed, the framework calls dispose() on the state object. Override the dispose function to do cleanup work