Flutter is a new language that has recently come out from the beta, implemented by Google on the basis of Dart language less known today than FLutter. It is a modern language but based on Dart, the syntax is very similar to any other modern object language. The main concept on which it is based is Everything is a widget. But what does it really mean? All we are dealing with when developing in Flutter is a widget. A widget may or may not have a status, which can determine its content or form. It could be seen as an object as you imagine it with the difference that it can have a state to update the view and it can contain contents and shapes.
Yes, you have understood shapes correctly, since a widget, besides defining properties and methods, can define shapes. Finally, a widget can include or extend another widget. So an app in flutter is the composition of the widgets together. An example could be a form containing n input text widgets etc. and a button also widget.
The main widget that we can make are of two types, at least for now before google upsets everything, and are as follows:
Widgets stateless (statelesswidget) are immutable, like a static class. A button that never changes color can be defined as a static widget. It can also be used in case we need to show only non-interactive descriptions.
Stateful widgets (statefulwidget): one (or more) property related to them, changing, can change the behavior, appearance or functionality of the widget. An app screen that changes based on content in an http response is a widget with status (just because the screen content varies based on the http response). Example: in case we need to request data from users and then update the same widget to validate or show an ok data entered correctly. To update the widget you need to use the setstate with the property updated so that the change is extended.
The thing I liked most about Flutter:
that we can develop everything through a single language.
the livereload works really well and allows us to write the code faster.
with single environment and same code we have a build for Android and IOS as Native
Recently flutter can also be used in web and desktop (Linux & Windows) :)
At the beginning I was a little skeptical about using widgets and it was a little complicated and dispersed to understand the advantages. After using them I must say that they are simpler than they seem to be implemented and thanks to this approach it will be easier to reason according to the best practice “DRY” (Don’t Repeat Yourself). On the one hand it adds an incredible nesting during the construction phase of the interface by boxing one widget into another and so on; however it has a logic that is modular in nature and this is excellent for decoupling small widgets that will consist of their properties and their tasks. By decoupling, we can test them and use them with different widgets to make more complex widgets. In this way the code will be more maintainable and functional.