05 Building App From Scratch (RunApp Fun)
05 Building App From Scratch (RunApp Fun)
• If you already have fun with flutter code then you might
notice that infinite Parent-Child tree. Yaa I agree, first time it
just scares out any beginner, but dear we all passes from the
same stage in which you are right now.
• Now when we know what is a widget, its time to know how many
types of widgets are there.
• Flutter has a rich set of in-built widgets like text, buttons, slider,
lists, layouts, gesture detector, animations, etc.
• Flutter team works really hard to create a set of widgets that
helps you in almost every situation. And they are continuously
adding more widgets as developers needs.
• But apart from built-in widgets, you can create your own widgets
according to your needs.
• Flutter divides widgets into two categories:
• Stateless Widgets
• Stateful Widgets
Stateless Widgets
• Recommended Reading:
– https://
stackoverflow.com/questions/50958238/what-is-a-widget-in-flutter
– https://medium.com/jay-tillu/4-what-is-widget-in-flutter-lets-clear-
the-basics-first-82f501c8d0f0#:~:text=In%20flutter%2C%20Widget
%20is%20a%20way%20to%20declare%20and%20construct
%20UI.&text=A%20widget%20might%20display%20Something,and
%20columns%20are%20also%20widgets.
runApp
• Now that we've successfully set up flutter and seen what the
project structure looks like
• Lets understand the flow of code
– Navigating the myApp Lib
• Open main.dart file and step into the code.
• So in the beginning flutter looks for a main function to begin
execution
• It looks for main() function in the main.dart file
• which is the entry point for the code
• Lets create the function void main
– runApp(text”Hello World”);
• now you see that there is an error that shows that
runApp isn't defined. This is because we have called
runApp but we haven't imported it into this file
• You can see that hello world has been displayed in the center of the screen, this is what the
base of every flutter code looks like And we will keep building on this code in our upcoming
tutorials until then keep fluttering.