Day 3 — What is StatefulWidget and an example of how it works

Gürkan Fikret GÜNAK
4 min readOct 19, 2020

Hello,
Today, we will examine one of the most important tools, StatefulWidget. As a field of use, many people get confused when it comes to mind, I think to write an article with a little clarity on this subject. In some documents, some articles or articles, a detailed explanation is provided, but software developers have come to understand the usage or this work in detail, there may be some stumbling points.

If we express it in a simple plain language, StatefulWidget will come before us as long as the structures have continuously variable and dynamic situations. As a simplest explanatory structure about this, let’s examine and understand a bit of the architectural structure of administrative processes for StatefulWidget, to display the dynamic change such as the incremental decrease in a current way or to reflect the result data according to the input data in the database.

It is useful to say the following as a technical comment about the Stateful structure. If you want the data to be displayed in a concrete way and you want to display a window in a concrete way, it will be displayed by pressing the screen when a method is renewed and updated continuously. We can provide development by using tools for more efficient and flexible operation of these structures, and these tools are divided into 2, forward-looking updates and updates from historical data.These tools already appear in our usage processes and facilitate the use of Stateful structures.

As I explained in my previous article, it is necessary to have trigger codes and functions in order to display the changes in situational structures on the screen. We have already seen and talked about one of them in my Last Post setState (),

However, these processes are not structures with only one state setting. Some structures can be displayed by storing the data in them and pressing them on the desired tools on the screens. One of them is Stream and another is ChangeNotifier. And these structures allow us to see situational changes quickly on the screen.

In our sample application you have written, we can also think that situational changes are not in a single structure, in fact, our entire code tree is completely viewable, so the slightest change we have made helps us to display it in the whole structure, this decorative interface design appears to be formed in the most beautiful scale. helps you get rid of intermediate performance and intermediate losses. The change of any situation also allows us to get results quickly in other tools.

After the global key definition is made, we can uniquely update the status and structure in just one tool. This eliminates the miscommunication between the communication between blogs and enables the result to be displayed by communicating the desired tool in a unique way.
StatefulWidget is divided into two groups.

First of all, the special structure I will express is that after the vehicle is created, it is only a one-time update or a dynamic change that benefits from the trigger process mentioned above. Continuous update is not included.

Widgets it interacts with — ChangeNotifier, Stream

Secondly, the expression gemis Structure is a tool that is in constant communication between the whole code block and builds itself by creating continuous changes.

Each time it builds a new repeatable structure within itself.
For example,

The simplest example of this is the clock structure. For example, let’s imagine a button that shows the time when the button is pressed, and only after getting the trigger point here it builds and remains without updating. But this is not very efficient in terms of use. What we want is to show the person-user by giving the screen to the screen at the moment and moment. The process here comes across and enables us to use the second structure. Although it is tiring in some applications in terms of performance, you can be sure that it saves the day for the end user.

You can watch an example video here.

Summary
If we want to make the multiple changes in our application to create new blocks, but to communicate within the existing blocks, we want to ensure that the structures are designed and the functions running in the background can be viewed efficiently, Stateful structures appear. As we said, it is divided into two. One of them only provides a one-time instant change and realizes our video capture. Secondly, if we want to constantly change, we also use this structure. This enables us to confront our application with a more dynamic interface in terms of the user.

#dart #flutter #google

--

--