Just like every Dart application starts with the main function, so does every Flutter app. But in a Flutter app, you also need to call the runApp function:
void main() => runApp(StaticApp());
This line initializes the Flutter framework and places a StaticApp, which is just another stateless widget, at the root of the tree.
Our root class, StaticApp, is just a widget. This class will be used to set up any global data that needs to be accessed by the rest of our app. However, in this case, it will just be used to kick off our widget tree, which consists of a MaterialApp and the custom ImmutableWidget.
One phrase that you frequently see in the official Flutter documentation is, "It's all widgets, all the way down." This phrase implies two things:
- Every item in Flutter inherits from the widget class. If you want it on the screen, it's a widget. Boxes are widgets. Padding is a widget. Even screens are widgets.
- The core data structure...