Flutter Basics guide featuring essential interview questions and answers, designed to help beginners and professionals excel in Flutter training and coding interviews. At Softloom IT Training, we empower you with the knowledge and skills to master Flutter programming and succeed in the tech world.
1. What is Flutter?
A) A programming language
B) A framework for mobile and web development
C) A database management system
D) A cloud service
Answer: B) A framework for mobile and web development
2. Who developed Flutter?
A) Facebook
B) Apple
C) Google
D) Microsoft
Answer: C) Google
3. What programming language does Flutter use?
A) Java
B) Swift
C) Dart
D) Kotlin
Answer: C) Dart
4. What is the command to create a new Flutter project?
A) flutter create my_app
B) flutter new my_app
C) flutter start my_app
D) flutter init my_app
Answer: A) flutter create my_app
5. Which widget is used as a root widget in a Flutter app?
A) MaterialApp
B) Container
C) Column
D) Stack
Answer: A) MaterialApp
6. What is the main advantage of Flutter?
A) Uses multiple programming languages
B) Single codebase for multiple platforms
C) No need for internet connectivity
D) No UI customization required
Answer: B) Single codebase for multiple platforms
7. Which of the following is NOT a type of widget in Flutter?
A) StatefulWidget
B) StatelessWidget
C) AnimatedWidget
D) DynamicWidget
Answer: D) DynamicWidget
8. How do you add a package dependency in a Flutter project?
A) Modify flutter_config.yaml
B) Edit pubspec.yaml
C) Use flutter install command
D) Add to flutter_packages.json
Answer: B) Edit pubspec.yaml
9. What does the setState() method do in Flutter?
A) Deletes a widget
B) Updates the UI by changing the widget’s state
C) Restarts the entire application
D) Stops all animations
Answer: B) Updates the UI by changing the widget’s state
10. What command is used to run a Flutter app on an emulator?
A) flutter run
B) flutter start
C) flutter execute
D) flutter build
Answer: A) flutter run
11. Which of these widgets allows you to create a scrollable list?
A) Row
B) Column
C) ListView
D) Stack
Answer: C) ListView
12. What does the hot reload feature in Flutter do?
A) Stops the app and restarts it
B) Rebuilds the UI instantly without losing state
C) Clears the application cache
D) Only works on Android devices
Answer: B) Rebuilds the UI instantly without losing state
13. Which widget is used for displaying an image in Flutter?
A) ImageView
B) Image
C) Picture
D) Img
Answer: B) Image
14. How do you navigate to a new screen in Flutter?
A) Navigator.push(context, MaterialPageRoute(builder: (context) => NewScreen()))
B) context.push(NewScreen())
C) NewScreen.open(context)
D) Navigate.to(NewScreen())
Answer: A) Navigator.push(context, MaterialPageRoute(builder: (context) => NewScreen()))
15. Which widget allows you to arrange items in a grid format?
A) ListView
B) GridView
C) Column
D) Stack
Answer: B) GridView
16. What is the purpose of the Scaffold widget in Flutter?
A) It creates a basic app layout structure
B) It manages user authentication
C) It is used for navigation
D) It is used only in iOS apps
Answer: A) It creates a basic app layout structure
17. What does the pub get command do?
A) Fetches dependencies for the project
B) Runs unit tests
C) Clears the Flutter cache
D) Builds the APK
Answer: A) Fetches dependencies for the project
18. What is StatefulWidget used for?
A) For static UI components
B) For components that need to change dynamically
C) For defining animations
D) For handling navigation
Answer: B) For components that need to change dynamically
19. What is Future in Dart?
A) A data type for storing past values
B) A class for handling asynchronous operations
C) A built-in Flutter widget
D) A function that runs instantly
Answer: B) A class for handling asynchronous operations
20. What is a Stream in Dart?
A) A continuous flow of data
B) A static list of values
C) A Flutter widget
D) A debugging tool
Answer: A) A continuous flow of data
21. Which Flutter package is commonly used for state management?
A) Provider
B) Navigator
C) Router
D) StackManager
Answer: A) Provider
22. What does the async keyword indicate in Dart?
A) The function returns immediately
B) That the function contains asynchronous code
C) The function only runs on Android
D) That the function is deprecated
Answer: B) That the function contains asynchronous code
23. Which function is used to handle errors in a Future?
A) try-catch
B) errorHandler()
C) onError()
D) catchError()
Answer: D) catchError()
24. How do you define a constant in Dart?
A) final x = 10;
B) const x = 10;
C) Both A & B
D) None of the above
Answer: C) Both A & B
25. What is the default build system for Flutter?
A) Gradle
B) Xcode
C) Maven
D) CocoaPods
Answer: A) Gradle
26. What is Bloc used for in Flutter?
A) A state management approach
B) A UI rendering engine
C) A database management system
D) A widget for handling gestures
Answer: A) A state management approach
27. What is the purpose of GestureDetector in Flutter?
A) To detect user interactions like taps and swipes
B) To display animations
C) To fetch data from an API
D) To control device sensors
Answer: A) To detect user interactions like taps and swipes
28. How do you define a function in Dart?
A) void myFunction() {}
B) def myFunction() {}
C) function myFunction() {}
D) new myFunction() {}
Answer: A) void myFunction() {}
29. What is the purpose of the build method in Flutter?
A) It builds the UI for a widget
B) It initializes state variables
C) It runs the main application logic
D) It compiles the Flutter project
Answer: A) It builds the UI for a widget
30. What is the main entry point function in a Flutter application?
A) main()
B) startApp()
C) flutterMain()
D) run()
Answer: A) main()
31. What is the primary layout mechanism used in Flutter?
A) Widgets
B) XML
C) HTML
D) JSON
Answer: A) Widgets
32. Which widget helps to create a responsive UI in Flutter?
A) Flexible
B) Row
C) Column
D) Stack
Answer: A) Flexible
33. Which folder contains the platform-specific code in a Flutter project?
A) /lib
B) /platform
C) /android and /ios
D) /src
Answer: C) /android and /ios
34. What does the ‘await’ keyword do in Dart?
A) Makes the function return immediately
B) Pauses the function until a Future completes
C) Runs the function on a separate thread
D) Executes code synchronously
Answer: B) Pauses the function until a Future completes
35. Which tool can be used to debug Flutter applications?
A) Flutter Inspector
B) Flutter Doctor
C) Flutter Fix
D) Flutter Cleaner
Answer: A) Flutter Inspector
36. Which widget is best for handling forms in Flutter?
A) Form
B) Container
C) Scaffold
D) AppBar
Answer: A) Form
37. What is the main purpose of the SizedBox widget?
A) To create a fixed size spacing between widgets
B) To hold multiple child widgets
C) To add borders to widgets
D) To show pop-up dialogs
Answer: A) To create fixed-size spacing between widgets
38. Which command upgrades Flutter SDK to the latest version?
A) Flutter upgrade
B) Flutter update
C) Flutter refresh
D) Flutter sync
Answer: A) Flutter upgrade
39. Which widget allows you to apply padding around a child widget?
A) Padding
B) Margin
C) Spacer
D) Container only
Answer: A) Padding
40. What does the keyword ‘final’ mean in Dart?
A) The variable cannot be reassigned
B) The value can be changed later
C) The variable can only be used inside functions
D) The variable is temporary
Answer: A) The variable cannot be reassigned
41. What is the primary role of the BLoC pattern in Flutter development?
A) Creating a responsive UI
B) Separating business logic from UI
C) Improving animation performance
D) Managing native code interaction
Answer: B) Separating business logic from UI
42. Which widget should be used to rebuild only part of the UI based on state changes in BLoC?
- BlocBuilder
- BlocConsumer
- BlocProvider
- StreamBuilder
Answer: A) BlocBuilder
43. How can side effects (like showing a dialog or navigating) be triggered using BLoC?
- Using BlocBuilder
- Using BlocListener
- Using BlocProvider
- Using StreamController
Answer: B) Using BlocListener
44. In Flutter, which widget allows you to overlay multiple widgets on top of each other, enabling precise control over their positioning within a single parent layout?
A) Row
B) Column
C) Stack
D) GridView
Answer: C) Stack
45. Which widget should be used to detect user taps in Flutter?
A) GestureDetector
B) TapView
C) Clickable
D) TouchWidget
Answer: A) GestureDetector
46. What is the purpose of the Expanded widget?
A) To show a full-screen alert
B) To scroll the content
C) To take available space in a Row/Column
D) To add animation
Answer: C) To take available space in a Row/Column
47. Which Dart data type can hold a value or null?
A) dynamic
B) void
C) late
D) nullable
Answer: A) dynamic
48. Which widget combines both building UI and handling side effects in BLoC?
- A) BlocSelector
B) BlocController
C) BlocConsumer
D) MultiBlocProvider
Answer: C) BlocConsumer
49. Which lifecycle method is called only once when a stateful widget is inserted into the widget tree?
A) build()
B) initState()
C) dispose()
D) didUpdateWidget()
Answer: B) initState()
50. When should you prefer Bloc over Cubit?
A) When the logic requires handling multiple complex events
B) When you want to rebuild the entire app
C) When the app uses only static data
D) When you are not using state at all
Answer: A) When the logic requires handling multiple complex events
51. Which of the following is NOT a Flutter state management approach?
A) Provider
B) BLoC
C) Redux
D) ReactJS Hooks
Answer: D) ReactJS Hooks
52. Which widget helps to make layouts responsive by taking available space?
A) Expanded
B) Align
C) Center
D) SizedBox
Answer: A) Expanded
53. What is the primary rendering engine used by Flutter?
A) Blink
B) WebKit
C) Skia
D) Gecko
Answer: C) Skia
54. What is the difference between hot reload and hot restart in Flutter?
A) Hot reload preserves state, hot restart resets state
B) Hot reload resets state, hot restart preserves state
C) Both preserve the state
D) Both reset state
Answer: A) Hot reload preserves state, hot restart resets state
55. Which file stores the Android-specific code for a Flutter app?
A) main.dart
B) build.gradle
C) AndroidManifest.xml
D) pubspec.yaml
Answer: C) AndroidManifest.xml
56. Which widget automatically adjusts its size to fit its content?
A) SizedBox
B) Flexible
C) Container
D) FittedBox
Answer: D) FittedBox
57. Which Flutter widget allows smooth animations when switching between widgets?
A) AnimatedSwitcher
B) AnimatedContainer
C) TweenAnimationBuilder
D) Hero
Answer: A) AnimatedSwitcher
58. Which of the following is NOT a valid Flutter widget?
A) Center
B) TextField
C) Fragment
D) ListTile
Answer: C) Fragment
59. Which widget is used for creating side navigation in Flutter?
A) Drawer
B) NavigationRail
C) Sidebar
D) Menu
Answer: A) Drawer
60. Which widget is used to create rounded corners for a child widget?
A) ClipRect
B) ClipRRect
C) RoundedBox
D) ShapeContainer
Answer: B) ClipRRect