Instructor: Let's take a look at the main.dart file that the application scaffold has given us. First, we import the flutter/material.dart package, which includes Flutter widgets implementing material design.
Every Dart application must have a top-level main function which serves as the entry point to the app. The main function returns runApp, which initializes the MyApp widget. The runApp function will inflate the given widget and attach it to the screen, in this case the MyApp widget.
MyApp is a stateless widget. A stateless widget is a widget that describes part of the user interface by building a group of other widgets that describe the user interface.
Stateless widgets are useful when the part of the user interface you are describing does not depend on anything other than the configuration information in the object itself and the arguments in which the widget is created.
Next, we call @override build. @override points out that the function, in this case the build function, is also defined in an ancestor class but is being redefined to do something else in the current class. It's also used to annotate the implementation of an abstract method.
In order for a widget to return other widgets, we must define a build method that describes this UI. The build method must always return a widget type. Here, the widget type that we're returning is MaterialApp.
Build receives an argument of context of type BuildContext. BuildContext is an abstract class acting as a handle to the location of a widget in the widget tree.
MaterialApp is a convenience widget that wraps a number of widgets that are commonly required for material design applications. It builds upon a WidgetsApp class, another Flutter convenience class, by adding material design-specific functionality.
The Myhome page widget is an instance of a stateful widget. A stateful widget is a widget that describes part of the user interface by building a constellation of other widgets that describe the user interface.
Stateful widgets are used when part of the user interface you're describing can change dynamically. Stateful widgets will return a state class, as we see with the _Myhome pageState class.
State objects are created by the framework by calling the StatefulWidget.createState method. In order to manage local state, we must use a combination of stateful widgets and state classes.