Flutter Certified Application Developer (AFD-200) — Questions and Answers
Question 1: Inside a Row or Column, which widget forces a child to fill the remaining available space?
- Spacer
- SizedBox
- Flexible (loose)
- Expanded (Correct answer)
Correct answer: Expanded
Expanded makes a child take all remaining space along the main axis.
Question 2: What is the purpose of compute() in Flutter?
- To run a heavy computation on a separate isolate without blocking the UI thread (Correct answer)
- To cache the result of a pure function
- To precompute widget layouts
- To schedule a widget rebuild on the next frame
Correct answer: To run a heavy computation on a separate isolate without blocking the UI thread
compute() spawns a new isolate to run a function, keeping expensive work off the main UI thread to prevent jank.
Question 3: When using AnimatedSwitcher, what determines how the old and new child widgets transition?
- The key assigned to the children
- The transitionBuilder parameter (Correct answer)
- The duration parameter only
- The Curves.linear default
Correct answer: The transitionBuilder parameter
AnimatedSwitcher's transitionBuilder callback wraps each child with a transition widget (e.g., FadeTransition), controlling how old and new children animate in and out.
Question 4: Which widget rebuilds its UI in response to a stream of asynchronous data?
- StreamBuilder (Correct answer)
- ListView
- AnimatedBuilder
- FutureBuilder
Correct answer: StreamBuilder
StreamBuilder listens to a Stream and rebuilds on each emitted event.
Question 5: What is the purpose of the freezed package commonly used with Flutter state management?
- To disable hot reload
- To freeze app frames for testing
- To cache network responses
- To generate immutable data classes and union types (Correct answer)
Correct answer: To generate immutable data classes and union types
freezed generates immutable value classes with copyWith(), equality, and union/sealed class support via code generation.
Question 6: Which method triggers a rebuild of a StatefulWidget after state changes?
- rebuild()
- setState() (Correct answer)
- refresh()
- update()
Correct answer: setState()
Calling setState() notifies the framework to rebuild the widget.
Question 7: Which file is the conventional entry point of a Flutter app?
- index.dart
- app.dart
- lib/main.dart (Correct answer)
- pubspec.yaml
Correct answer: lib/main.dart
Execution begins at the main() function in lib/main.dart.
Question 8: Which widget would you use to make any child respond to taps without a Material ripple?
- Checkbox
- GestureDetector (Correct answer)
- ElevatedButton
- TextButton
Correct answer: GestureDetector
GestureDetector wraps a child to detect taps, drags, and other gestures.
Question 9: Which Flutter class allows descendant widgets to access data without passing it explicitly through constructors?
- InheritedWidget (Correct answer)
- StatelessWidget
- Container
- StatefulWidget
Correct answer: InheritedWidget
InheritedWidget propagates data down the widget tree, enabling descendants to access it via context.
Question 10: Which widget arranges its children vertically?
- Stack
- Wrap
- Column (Correct answer)
- Row
Correct answer: Column
Column lays out its children in a vertical direction.
Question 11: Which widget adds padding around its child?
- Margin
- Padding (Correct answer)
- Align
- Spacer
Correct answer: Padding
Padding insets its child by the given EdgeInsets amount.
Question 12: How does Navigator 2.0 differ from Navigator 1.0 in Flutter?
- Navigator 2.0 is declarative and uses a pages list, enabling URL-driven navigation (Correct answer)
- Navigator 2.0 only works on web
- Navigator 2.0 removes named routes
- Navigator 2.0 uses a Stack widget instead of Navigator
Correct answer: Navigator 2.0 is declarative and uses a pages list, enabling URL-driven navigation
Navigator 2.0 uses a declarative pages list driven by app state, making back-stack management and deep linking explicit.
Question 13: In GetX state management, which class do you extend to create a reactive controller?
- GetxController (Correct answer)
- StateNotifier
- ChangeNotifier
- BlocBase
Correct answer: GetxController
GetxController is the base class for GetX controllers, providing lifecycle hooks and reactive state.
Question 14: Which method do you use to find a widget by its type in a Flutter widget test?
- find.text()
- find.byType() (Correct answer)
- find.byKey()
- find.byWidget()
Correct answer: find.byType()
find.byType() locates widgets of a specified type in the widget tree during a test.
Question 15: What is a named route in Flutter?
- A route that uses a custom transition animation
- A route that accepts URL query parameters
- A route with an AppBar title
- A route identified by a string name registered in MaterialApp's routes map (Correct answer)
Correct answer: A route identified by a string name registered in MaterialApp's routes map
Named routes are identified by string identifiers registered in the routes map of MaterialApp, navigated to with Navigator.pushNamed().
Question 16: How do you simulate a user tapping a widget in a Flutter widget test?
- tester.click()
- tester.tap() (Correct answer)
- tester.press()
- tester.touch()
Correct answer: tester.tap()
WidgetTester.tap() simulates a touch at the center of the widget found by a Finder.
Question 17: What is the purpose of the Hero widget in Flutter navigation?
- It adds a full-screen background image
- It animates a shared element between two screens during a route transition (Correct answer)
- It marks the primary content area of a screen
- It creates a floating action button
Correct answer: It animates a shared element between two screens during a route transition
Hero animates a widget smoothly from one screen to another by matching hero tags during a route transition.
Question 18: Which package is widely used for making HTTP requests in Flutter?
- http (Correct answer)
- shared_preferences
- intl
- sqflite
Correct answer: http
The http package provides a simple API for HTTP requests.
Question 19: What is deep linking in the context of Flutter navigation?
- Sharing state between routes
- Creating nested navigators
- Navigating to a specific screen via a URL or universal link from outside the app (Correct answer)
- Linking two widgets together programmatically
Correct answer: Navigating to a specific screen via a URL or universal link from outside the app
Deep linking allows an external URL or push notification to open the app and navigate directly to a specific screen.
Question 20: In flutter, a Widget is equivalent to:
- A component of our applications' design
- A class that accepts parameters
- A control or object that can be included in our applications. (Correct answer)
- 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 21: What is the entry point of every Flutter application?
- The Scaffold widget
- The MaterialApp widget
- The build() method
- The runApp() call inside main() (Correct answer)
Correct answer: The runApp() call inside main()
Execution begins in main(), which calls runApp() to attach the root widget.
Question 22: What Flutter test type verifies that a widget renders and interacts correctly using a test environment?
- Smoke test
- Unit test
- Widget test (Correct answer)
- Integration test
Correct answer: Widget test
Widget tests (also called component tests) test a single widget using the WidgetTester API in a simulated environment.
Question 23: Which method should be used to release resources like controllers?
- dispose() (Correct answer)
- setState()
- initState()
- deactivate()
Correct answer: dispose()
dispose() is called when the State is permanently removed, ideal for cleanup.
Question 24: Which package is the standard choice for mocking dependencies in Flutter unit and widget tests?
- fake_async
- mockito (Correct answer)
- test_double
- mocktail
Correct answer: mockito
mockito is the widely used Dart mocking library that generates mock classes via code generation with @GenerateMocks.
Question 25: What does the expect() function do in a Flutter test?
- It asserts that the actual value matches the matcher (Correct answer)
- It registers a test case
- It navigates to the next screen in a test
- It pumps the widget tree
Correct answer: It asserts that the actual value matches the matcher
expect() compares an actual value against a matcher (like equals(), isTrue, findsOneWidget) and fails the test if they don't match.
Question 26: Which type of Flutter test runs entirely in the Dart VM without a device and tests a single class or function?
- Unit test (Correct answer)
- Widget test
- Golden test
- Integration test
Correct answer: Unit test
Unit tests run in the Dart VM, testing individual functions or classes in isolation without any Flutter framework involvement.
Question 27: How does Flutter's Hero animation work between two routes?
- It relies on AnimationController.repeat()
- It copies the widget and fades between copies
- It shares a tagged widget and flies it between the source and destination screens (Correct answer)
- It uses a PageRouteBuilder with a custom transition
Correct answer: It shares a tagged widget and flies it between the source and destination screens
Hero matches widgets with the same tag across routes and animates the shared element from its position on the source page to its position on the destination page.
Question 28: Which Flutter widget interpolates its properties (color, size, padding) automatically over a given duration when they change?
- AnimatedContainer (Correct answer)
- TweenAnimationBuilder
- ImplicitlyAnimatedWidget
- AnimatedBuilder
Correct answer: AnimatedContainer
AnimatedContainer automatically animates changes to its decoration, size, alignment, and padding over the specified duration without requiring a controller.
Question 29: Which widget should you use to avoid rebuilding expensive subtrees when parent state changes?
- AnimatedBuilder
- RepaintBoundary
- const constructor widgets (Correct answer)
- StatelessWidget
Correct answer: const constructor widgets
Marking widgets as const tells the Dart compiler they are immutable, so Flutter can skip rebuilding them when the parent rebuilds.
Question 30: The Dart platform is famous for not supporting "hot reload."
- False (Correct answer)
- True
Correct answer: False
This statement is false. Flutter, which uses Dart, is famously known for its 'hot reload' feature. Hot reload allows developers to inject updated source code into a running application, instantly seeing changes without losing the current application state, significantly speeding up development cycles.
Question 31: What does Navigator.pushAndRemoveUntil() do?
- Pushes a route and removes only the current route
- Pushes a route and schedules a pop after a delay
- Replaces the entire route stack with a single route
- Pushes a route and removes all routes from the stack up to a predicate condition (Correct answer)
Correct answer: Pushes a route and removes all routes from the stack up to a predicate condition
pushAndRemoveUntil pushes a new route and removes all routes below it until the predicate returns true.
Flutter Certified Application Developer (AFD-200)
The AFD-200 certifies developers on building cross-platform mobile applications using Google's Flutter framework and Dart programming language, covering widgets, navigation, state management, Firebase integration, and app publishing.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds