Viva Questions-Flu
Viva Questions-Flu
1. What is Flutter?
• Flutter is an open-source framework created by Google for building cross-platform
apps using a single codebase.
2. Which programming language does Flutter use?
• Flutter uses Dart as its programming language.
3. What is a widget in Flutter?
• A widget is an element in Flutter that defines how a part of the UI looks and behaves.
Everything is a widget, like buttons, text, or images.
4. What is a StatelessWidget?
• A StatelessWidget is a widget that doesn't change once it is built. It is static and
doesn't hold any mutable state.
5. What is a StatefulWidget?
• A StatefulWidget can change its state during runtime. It can be rebuilt when the state
changes.
6. What is the BuildContext in Flutter?
• BuildContext is the location of a widget in the widget tree and is used to access
information about the widget’s position.
7. What is setState?
• setState is a method that tells Flutter that the state of a widget has changed, so it can
rebuild the widget with the new state.
8. What is hot reload in Flutter?
• Hot reload allows you to quickly see the changes made to the code without
restarting the app.
9. What is hot restart in Flutter?
• Hot restart restarts the app, losing the current state, and applies the changes.
10. What is a Future in Dart?
• A Future represents a value that will be available later, often used for asynchronous
operations like fetching data from a server.
11. What is async and await in Dart?
• async marks a function as asynchronous, and await pauses the function until the
result of a Future is available.
12. What is a Container in Flutter?
• A Container is a versatile widget used to style its child widgets with properties like
padding, margin, color, and size.
13. What is the Scaffold widget used for?
• Scaffold is used to create the basic structure of the app, including the AppBar,
Drawer, Bottom Navigation, and Body.
14. What is Navigator in Flutter?
• Navigator manages the routes or screens in the app, allowing you to push or pop
new screens to navigate between them.
15. What is a ListView?
• A ListView is a scrolling widget used to display a list of items.
16. What is the pubspec.yaml file?
• The pubspec.yaml file is where you define your app’s dependencies, assets, and
other configurations.
17. What is a Stream in Dart?
• A Stream is used to handle asynchronous sequences of events, such as data from a
network or a user input.
18. How do you add a package or dependency in Flutter?
• To add a package, open the pubspec.yaml file and add the package under
dependencies, then run flutter pub get.
19. What is InheritedWidget?
• InheritedWidget is a widget that allows data to be passed down the widget tree to
child widgets.
20. What is Provider in Flutter?
• Provider is a state management package used to share data across the widget tree in
a more efficient way.
21. What is FutureBuilder in Flutter?
• FutureBuilder is a widget used to display data from a Future and update the UI based
on its state (loading, data available, or error).
22. What is a Form widget used for?
• The Form widget is used to group and manage form fields and validate them.
23. How do you handle user input in Flutter?
• You can use form fields like TextField, TextFormField, or custom widgets to handle
and validate user input.
24. What is a Row in Flutter?
• A Row widget is used to arrange its children horizontally.
25. What is a Column in Flutter?
• A Column widget is used to arrange its children vertically.
26. What is the difference between mainAxisAlignment and crossAxisAlignment?
• mainAxisAlignment: Aligns children along the main axis (horizontal or vertical).
• crossAxisAlignment: Aligns children along the perpendicular axis.
27. What is flutter doctor?
• flutter doctor is a command that checks your environment setup and reports any
issues with your Flutter installation.
28. What is a Drawer in Flutter?
• A Drawer is a slide-out menu typically used for app navigation.
29. How do you manage navigation in Flutter?
• Navigation in Flutter can be managed using the Navigator widget or other packages
like flutter_navigation or go_router.
30. What is AppBar in Flutter?
• AppBar is a widget that displays a toolbar at the top of the screen, commonly used
for app titles and actions.