Google Flutter Essentials 1 — Questions and Answers
Question 1: Flutter's original version was codenamed _____and ran on the Android operating system.
- Moon
- Feather
- Sky (Correct answer)
- Cloud
Correct answer: Sky
Flutter's initial version was indeed codenamed 'Sky' when it was first introduced by Google. It was conceived as a new mobile UI framework, primarily designed to run efficiently on the Android operating system. This early development laid the foundation for what would become the cross-platform Flutter framework we know today.
Question 2: In flutter, a Widget is equivalent to:
- A control or object that can be included in our applications. (Correct answer)
- A class that accepts parameters
- A component of our applications' design
- None of the preceding
Correct answer: A control or object that can be included in our applications.
In Flutter, a Widget is the fundamental building block of the user interface. Everything you see on the screen, from a simple text label to a complex layout structure, is a widget. They are essentially declarative descriptions of a part of your user interface, acting as controls or objects that can be composed to create your application's UI.
Question 3: Corresponds to a Widget that does not save a state and cannot modify on its own.
- StatefulWidget
- StatelessWidget (Correct answer)
- FullWidget
- StateWidget
Correct answer: StatelessWidget
A StatelessWidget is a widget that does not have any mutable state. Its configuration is entirely defined by the arguments passed to its constructor, and once built, it cannot change its appearance or behavior without being rebuilt by its parent. This makes them ideal for static UI elements that don't need to react to user input or data changes internally.
Question 4: They are two of the directories that make up a project's structure in Flutter.
- .gitignore <br> test </br>
- lib <br> .pubspec.lock </br>
- android <br> ios </br> (Correct answer)
- main.dart <br> app.dart </br>
Correct answer: android <br> ios </br>
When you create a Flutter project, it automatically generates platform-specific directories, most notably 'android' and 'ios'. These folders contain the native project files required to build and run your Flutter application on Android and iOS devices, respectively. They allow for platform-specific configurations, integrations with native APIs, and the embedding of the Flutter engine.
Question 5: They are the primary methods used in Flutter to define the execution point of our application.
- StatelessWidget <br> StatefulWidget </br>
- start <br> runApp </br>
- My App <br> Class </br>
- main <br> runApp </br> (Correct answer)
Correct answer: main <br> runApp </br>
Every Flutter application starts its execution with the `main()` function, which is the entry point for all Dart programs. Inside `main()`, the `runApp()` function is called, taking a Widget as an argument. This `runApp()` function is responsible for inflating the given widget and attaching it to the screen, making it the root of your application's widget tree.
Question 6: It is the function that must be implemented when we inherit from the StatelessWidget class.
- build( ) (Correct answer)
- setState( )
- main( )
- runApp( )
Correct answer: build( )
When you create a `StatelessWidget`, you are required to override the `build()` method. This method is crucial because it describes the user interface represented by the widget, returning a tree of other widgets that Flutter will render. The `build()` method takes a `BuildContext` as an argument, which provides information about the widget's location in the widget tree.
Question 7: These are some of the characteristics that can be assigned to a Scaffold.
- appBar <br> child </br>
- children <br> title </br>
- appBar <br> body </br> (Correct answer)
- home <br> body </br>
Correct answer: appBar <br> body </br>
The `Scaffold` widget in Flutter provides a basic Material Design visual structure for your application. It offers several properties to easily implement common UI elements, such as `appBar` for the top bar and `body` for the main content area of the screen. Other common characteristics include `floatingActionButton`, `drawer`, and `bottomNavigationBar`.
Flutter's original version was codenamed _____and ran on the Android operating system.