This content originally appeared on DEV Community and was authored by huangli huang
If you’re preparing for a Flutter engineer interview, you might be wondering what kinds of questions hiring managers typically ask. Based on real-world interview patterns, I’ve compiled the most frequently asked Flutter interview questions along with sample answers so you can study efficiently.
Flutter & Dart Fundamentals
- Q: What is the different between StatelessWidget and StatefulWidget?
A: A StatelessWidget has no internal state and always renders the same UI. It’s used for static UI like text or icons. A StatefulWidget maintains state across rebuilds and can update its UI dynamically using setState(). Use it for inputs, toggle, or dynamic data.
Q: What’s the difference between final and const in Dart?
A: final means the variable is assigned once at runtime but not know at compile-time. const means the value is a compile-time constant and deeply immutable. Example: final date = DateTime.now(); const pi = 3.14;Q: Explain Hot Reload vs. Hot Restart.
A: Hot reload injects updated code while preserving the app state. Hot Restart restarts the app entirely, losing current state but ensuring a fresh run.
State Management
- Q: What are some state management approaches in Flutter?
A: Options include setState, InheritedWidget, Provider, Riverpod, Bloc, GetX, and MobX.
- Q: How do you decide which one to use?
A: For simple UI updates, use setState. For medium apps, Provider or Riverpod balances simplicity and scalability. For large or event-driven apps, Bloc provides structure and testability.
Navigation & Routing
- Q: What’s the difference between Navigator 1.0 and Navigator 2.0?
A: Navigator 1.0 is imperative (push/pop routes directly). Navigator 2.0 is declarative and works better with deep linking, dynamic routes, and web apps.
- Q: How do you pass data between?
A: Pass via constructor arguments when pushing routes, return results using Navigator.pop(context, result), or use shared state with Provider/Bloc for complex cases.
Performance & Optimization
- Q: How do you reduce unnecessary widget rebuilds?
A: Use const constructors, avoid rebuilding entire widget trees by splitting widgets, use Keys to preserve state, and optimize rebuild logic with Selector or BlocBuilder.buildWhen.
- Q: How do you reduce app size?
A: Use tree shaking to remove unused code, split builds per ABI (–split-per-abi), compress/convert images to WebP, and use –split-debug-info for release builds.
UI & Animations
Q: What’s the difference between implicit and explicit animations?
A: Implicit animations (e.g., AnimatedContainer) handle transitions automatically and are simple but limited. Explicit animations use AnimationController and provide fine-grained control over timing and curves.
- Q: How do you implement a Hero animation?
A: Wrap widgets in Hero(tag: ‘id’, child: widget). Use the same tag on both source and destination widgets. Flutter automatically animates the transition.
Networking & Data
Q: How do you fetch data from an API?
A: Use the http or dio package. Example with http:
final response = await http.get(Uri.parse('https://api.example.com/data'));
final data = jsonDecode(response.body);
- Q: How do you store data locally?
A: Use SharedPreferences for small key-value data, Hive for lightweight NoSQL storage, and Sqflite or Drift for relational databases.
Testing
Q: What’s the difference between unit, widget , and integration test?
A: Unit tests check individual functions/classes. Widget tests verify UI behavior in isolation using WidgetTester. Integration tests run on real/simulated devices to validate full app workflows.
Platform Integration
Q: How do you call native code in Flutter?
A: Use MethodChannel to invoke platform-specific APIs (e.g., battery level). Use EventChannel for continuous streams like accelerometer or GPS updates.
Advanced Topics
Q: What is an isolate in Flutter?
A: An Isolate is an independent thread of execution with its own memory. Use it for CPU-heavy tasks like parsing large JSON files to avoid blocking the UI thread. The compute() function is a convenient way to run code in background isolate.
Q: How do you structure a large Flutter project?
A: Use feature-first or Clean Architecture. Typical layers: data(repositories, APIs, DB), domain(entities, use cases), presentation (UI, state, management). This separation improves testability and maintainbility.
Final Thoughts:
Most Flutter engineer interviews test both fundamentals(widgets, Dart, state) and practical skills (architecture, performance, deployment). The best preparation is:
- Practicing small coding tasks (e.g., building a Todo app).
- Reviewing state management patterns.
- Understanding app lifecycle, navigation, and optimization.
Pro Tips: Interviewers often ask why you chose a particular approach. Be ready to explain trade-offs with examples.
This content originally appeared on DEV Community and was authored by huangli huang