Hot Reload & Tooling Questions with Answers

14 practice questions on Hot Reload & Tooling (Flutter & Dart) with answers and step-by-step solutions. Try 10 samples below, then practise all 14 free in the AptiNest app.

Sample questions

Question 1Easy

How does hot restart differ from hot reload?

  1. There is no difference; they are two names for the same thing
  2. Hot restart keeps the state, while hot reload always resets it
  3. Hot restart also recompiles all native Kotlin and Swift code
  4. Hot restart reruns main() and loses state

Answer: D. Hot restart reruns main() and loses state

Explanation

Hot restart resets the Dart app to its initial state, which is slower than hot reload but faster than a full rebuild.

Step-by-step solution

  1. Hot reload updates code while keeping the app’s current state.
  2. Hot restart stops the app, recompiles, and starts it anew.
  3. Hot restart reruns main() and loses state.

Why the other options are wrong

  • A. The two differ: hot restart restarts the app and resets state, while hot reload keeps it.
  • B. This reverses it: hot reload keeps state, and hot restart is the one that resets it.
  • C. Hot restart does not rebuild native Kotlin or Swift code; it restarts the Dart side.

Tip: Use hot reload for UI tweaks; use hot restart when you need a fresh start.

Question 2Easy

What does hot reload do?

  1. Reinstalls the native app on the device from scratch
  2. Restarts the app from main() and clears all of its state
  3. Rebuilds the release APK and uploads it to the device
  4. Updates the running app's code and keeps its state

Answer: D. Updates the running app's code and keeps its state

Explanation

Hot reload updates classes in the running Dart VM and rebuilds the widget tree, so you see changes without losing the current screen or state.

Step-by-step solution

  1. Hot reload applies code changes to a running app.
  2. It keeps the app's current state and UI intact.
  3. Only the updated parts of the code are reloaded.
  4. The user doesn't lose their progress or screen data.
  5. Updates the running app's code and keeps its state.

Why the other options are wrong

  • A. Hot reload does not reinstall the app; it patches the running code.
  • B. Restarting from main and clearing state is hot restart, not hot reload.
  • C. Release APKs are not built by hot reload; it works on a running debug app.

Tip: Hot reload saves time by avoiding full restarts during development.

Question 3Easy

What does flutter doctor do?

  1. Scans the app's dependencies for security issues
  2. Profiles the running app and finds slow frames
  3. Fixes compile errors in the project's Dart source files
  4. Checks your SDKs, toolchains and devices for problems

Answer: D. Checks your SDKs, toolchains and devices for problems

Explanation

flutter doctor lists missing Android SDK pieces, Xcode setup, licences and connected devices.

Step-by-step solution

  1. Flutter doctor checks if the Flutter SDK is properly installed.
  2. It verifies if all required toolchains like Android Studio or Xcode are set up correctly.
  3. It looks for missing dependencies such as device drivers or licenses.
  4. It ensures connected devices are recognized by the system.
  5. Finally, it reports any issues found in the setup process.

Why the other options are wrong

  • A. Dependency security scanning is not flutter doctor's job; that needs a separate audit tool.
  • B. Profiling slow frames is done with DevTools, not flutter doctor.
  • C. flutter doctor does not fix Dart source errors; it checks the environment and reports issues.

Tip: Use flutter doctor to quickly check if your Flutter environment is ready for development.

Question 4Easy

Which file declares a Flutter project's dependencies, assets and fonts?

  1. package.json
  2. pubspec.yaml
  3. Info.plist
  4. build.gradle

Answer: B. pubspec.yaml

Explanation

pubspec.yaml is the Dart/Flutter project manifest; Gradle and Info.plist are native-platform files.

Step-by-step solution

  1. package.json is used for Node.js projects, not Flutter.
  2. Info.plist is a configuration file for iOS applications.
  3. build.gradle is used for Android project configuration.
  4. pubspec.yaml is the manifest file for Dart and Flutter projects.
  5. It declares dependencies, assets, and fonts for the project.
  6. The correct answer is pubspec.yaml.

Why the other options are wrong

  • A. package.json is for Node.js projects, so it is not the Flutter manifest.
  • C. Info.plist is an iOS configuration file, not the place for dependencies or assets.
  • D. build.gradle configures the Android build; it does not declare Flutter assets or fonts.

Tip: Remember that pubspec.yaml is the heart of any Flutter project configuration.

Question 5Medium

Why do release builds run noticeably faster than debug builds?

  1. Release builds disable the garbage collector to save processing time
  2. Release builds skip layout and painting for widgets that are off-screen
  3. Release builds run on a faster GPU-only isolate rather than the CPU
  4. Code is AOT-compiled and debug checks such as asserts are removed

Answer: D. Code is AOT-compiled and debug checks such as asserts are removed

Explanation

Debug mode runs JIT code with assertions and debugging services. Release mode is optimised native code without those overheads.

Step-by-step solution

  1. Release builds compile code ahead of time using AOT to speed up execution.
  2. Debug checks like asserts are removed in release builds for efficiency.
  3. AOT compilation reduces runtime overhead compared to JIT in debug mode.
  4. Removed debug checks save processing time during execution.
  5. Optimised native code runs faster than interpreted or checked code.
  6. Final answer: Code is AOT-compiled and debug checks such as asserts are removed.

Why the other options are wrong

  • A. Release builds do not turn off the garbage collector; Dart's GC runs in every build mode.
  • B. Release mode does not change which widgets are laid out; the speed gain comes from compilation.
  • C. Release code runs on the CPU like debug; there is no separate GPU-only isolate.

Tip: Remember: Release builds optimise code for speed by removing debug features.

Question 6Medium

You edit the AndroidManifest.xml or a Swift file in the ios folder. How do you see the change?

  1. Stop the app and run a full rebuild
  2. Use hot reload, which reloads native files
  3. Run flutter pub get, then hot reload again
  4. Use hot restart, which recompiles native code

Answer: A. Stop the app and run a full rebuild

Explanation

Hot reload and hot restart only update Dart code. Native code and configuration are compiled into the app binary, so it must be rebuilt.

Step-by-step solution

  1. Editing AndroidManifest.xml or Swift files changes native code.
  2. Native code requires a full rebuild to take effect.
  3. Stop the app and run a full rebuild to see the change.
  4. Full rebuild ensures all native files are recompiled.
  5. Final answer: A (Stop the app and run a full rebuild).

Why the other options are wrong

  • B. Hot reload does not load native files; it only updates the Dart code in the running app.
  • C. pub get fetches Dart packages and does not change native files, so it does not show the edit.
  • D. Hot restart does not recompile native code; the native change still needs a full rebuild.

Tip: For native changes, always stop and rebuild the app.

Question 7Medium

You change the initial value of a field in a State class (int count = 5; instead of 0) and hot reload. The counter still shows the old value. Why?

  1. The change is a compile error that hot reload hides without showing a message
  2. Field values are cached on disk, so the app has to be uninstalled and reinstalled
  3. Hot reload keeps State objects, so field initialisers do not rerun
  4. Hot reload ignores every change made in State classes and only reloads stateless ones

Answer: C. Hot reload keeps State objects, so field initialisers do not rerun

Explanation

Hot reload preserves state by design. Code that only runs on creation, such as field initialisers and initState, needs a hot restart to take effect.

Step-by-step solution

  1. Field initialisers run once when State object is created.
  2. Hot reload keeps existing State objects without reinitialising fields.
  3. Changes to field values after creation are not detected by hot reload.
  4. Initial value changes in code do not trigger reruns of field initialisers.
  5. So the counter shows old value until app is restarted.

Why the other options are wrong

  • A. Hot reload does not hide compile errors; the change is valid and runs, so no error is involved.
  • B. Field values are not stored on disk; no reinstall is needed to see the new initial value.
  • D. Hot reload does reload State classes; it keeps existing State objects but applies the new code.

Tip: Hot reload keeps State objects; changes to fields require a full restart.

Question 8Medium

Which tool lets you inspect the widget tree and see slow (janky) frames of a running Flutter app?

  1. flutter doctor
  2. pub.dev
  3. Flutter DevTools
  4. flutter create

Answer: C. Flutter DevTools

Explanation

DevTools includes a widget inspector, a performance view with frame charts, and memory and network views.

Step-by-step solution

  1. Flutter DevTools lets you inspect the widget tree of a running app.
  2. It shows slow frames through its performance view.
  3. DevTools includes tools for memory and network analysis.
  4. The widget inspector helps find UI issues quickly.
  5. Performance view with frame charts identifies janky frames.
  6. Final answer: Flutter DevTools.

Why the other options are wrong

  • A. flutter doctor checks the setup; it does not inspect the widget tree or frames.
  • B. pub.dev is a package site for publishing and finding packages, not a debugging tool.
  • D. flutter create makes a new project; it does not inspect a running app.

Tip: Use Flutter DevTools for comprehensive app analysis and optimization.

Question 9Hard

An assert(items.isNotEmpty) is in your code. What happens to it in a release build?

  1. It becomes a compile-time error check
  2. It throws an exception if items is empty
  3. It logs a warning but continues running
  4. It is removed and never evaluated

Answer: D. It is removed and never evaluated

Explanation

Assertions run only in debug mode; in release (and profile) builds they are stripped, so never rely on them for production logic.

Step-by-step solution

  1. In debug builds, assert checks if items is not empty.
  2. Release builds remove assertions to optimize performance.
  3. Removed code is not executed in any build type.
  4. So the assert is removed and never evaluated.
  5. Final answer: It is removed and never evaluated.

Why the other options are wrong

  • A. assert is a runtime check, not a compile-time check; it does not become a compile error.
  • B. In release, the assert is not evaluated, so it throws nothing even when items is empty.
  • C. Asserts do not log a warning; in release they are removed entirely, so nothing is logged.

Tip: Never use assertions for critical logic; they are stripped in release builds.

Question 10Hard

Why is hot reload not available in release builds?

  1. Release code is AOT-compiled to fixed machine code, so the VM cannot patch it
  2. Release builds are signed, and changing the code would break the signature
  3. Hot reload is turned off only by a flag that a release build cannot change
  4. Release builds run the Dart code on the device's GPU instead of the CPU

Answer: A. Release code is AOT-compiled to fixed machine code, so the VM cannot patch it

Explanation

Hot reload relies on the JIT VM in debug mode loading new kernel code. AOT release binaries contain only precompiled machine code.

Step-by-step solution

  1. Hot reload needs JIT to load new code.
  2. Release uses AOT which compiles to fixed machine code.
  3. VM can't patch fixed machine code.
  4. So hot reload isn't possible in release builds.
  5. Final answer: Release code is AOT-compiled to fixed machine code, so the VM cannot patch it.

Why the other options are wrong

  • B. Signing is not the reason; release builds can be signed without blocking hot reload.
  • C. The flag is not the reason; hot reload depends on how the code runs, which is AOT in release.
  • D. Release builds run Dart on the CPU as native code, not the GPU; that is not why reload is absent.

Tip: Remember: Hot reload only works with JIT in debug mode.

Practise all 14 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Flutter & Dart topics · All topics