0% found this document useful (0 votes)
5 views

flutter MCQS

Uploaded by

Shahmeer Akram
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

flutter MCQS

Uploaded by

Shahmeer Akram
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

-Flutter uses Dart programming language.

-StatelessWidget is immutable.
-StatefulWidget maintains state.
-main() function initializes the app.
-runApp() starts the widget tree.
-Padding adds spacing inside a widget.
-main.dart: Entry point of the application.
-AppBar: Displays a toolbar with titles, icons, and actions.

Widgets:
-Text displays text.
-Container is a box model widget.
-Row arranges widgets horizontally.
-Column arranges widgets vertically.
-Stack layers widgets on top of each other.
-Use Image.asset for local images and Image.network for remote images with caching.
-SizedBox: Adds fixed space or dimensions to a widget.
-InkWell Widget – Detect taps with ripple effects.
-CustomScrollView – Create scrollable effects.

MCQs from Installation Process:


-Which command is used to create a new Flutter project without using VS Code?
flutter create <app name>

-What is the next command after creating a Flutter app to navigate into the app
directory?
cd <app name>

-Which command is used to run the default Flutter app without VS Code?
flutter run

-What is the purpose of the code . command when creating a Flutter app with VS
Code?
Opens the folder in VS Code

-What happens when you type flutter run after navigating to your Flutter project
folder?
It launches the default Flutter app

-After running the command code ., what should you do next in VS Code to launch the
app?
Run flutter run in the VS Code terminal

-setState() updates UI for StatefulWidget.


-InheritedWidget for propagating data down the widget tree.
-Use Navigator.push() to navigate to another page.
-ThemeData is used for app-wide theming.
-Use TextField for user input.
-FutureBuilder rebuilds UI based on future data.
-StreamBuilder is used for listening to streams.
-sqflite for SQLite-based local database.
-Flutter’s framework is declarative.
-StatelessWidget widgets cannot use setState().
-The Widget is rebuilt when setState() is called.
-ThemeData is used to define app-wide theming, including colors, fonts, and styles.
-pubspec.yaml: Defines app metadata, dependencies, and assets.
-lib/ folder: Contains the main Dart code for the application.
-Alignment: Use Alignment (e.g., Alignment.center) to position widgets inside
containers or layouts.
-Flex Widgets: Use Flexible or Expanded to distribute space in a Row or Column.
-MediaQuery: Access device-specific dimensions like screen width and height.
-TextEditingController: Captures and manages user input in TextField.

Flutter CLI Commands


-flutter doctor: Checks your system for Flutter installation issues.
-flutter create <app_name>: Creates a new Flutter app.
-flutter pub get: Fetches packages listed in pubspec.yaml.
-flutter clean: Clears the build cache.
-flutter analyze: Analyzes code for potential errors.
-flutter upgrade: Updates Flutter to the latest version.

Important Points From Boiler Plate code(Stateful):


-StatefulWidget is used to create widgets that can maintain state and update the UI
dynamically when the state changes.
-The main() function is the entry point of the Flutter application.
-The runApp() function is used to start the Flutter app and attach the widget tree
to the screen.
-The myapp class extends StatefulWidget to create a stateful widget.
-The Scaffold widget, commonly used to provide structure (AppBar, Body, etc.).

Important Points From Boilerplate Code (StatelessWidget):


-StatelessWidget is used to create widgets that do not maintain any state and are
immutable (the widget's properties cannot change once created).
-The main() function is the entry point of the Flutter application.
-The runApp() function is used to start the Flutter app and attach the widget tree
to the screen.
-The myapp class extends StatelessWidget to create a stateless widget.
-The Scaffold widget can be used to provide basic app structure (like AppBar, Body,
and FloatingActionButton).

Hot Reload: Updates UI without restarting the app.


Hot Restart: Rebuilds the app from scratch.

Keys in Flutter:
GlobalKey, LocalKey, UniqueKey.

Important Points About Buttons in Flutter:

-ElevatedButton: Used for buttons with elevation and a background color.


-TextButton: A flat button with only text, typically used for less prominent
actions.
-OutlinedButton: Displays a button with an outline border and transparent
background.
-IconButton: Used for buttons with icons instead of text.
-onPressed Property: Defines the function executed when the button is clicked.
-ElevatedButton.icon: Combines an icon and text on an elevated button.
-TextButton.icon: Combines an icon and text on a text button.

You might also like