State, Navigation and Networking Questions
1. What is state management and why do you need it?
State is data that changes over time. State management is how you store, update and share that data so that the UI stays in sync. Without it, passing data through many widgets becomes messy.
2. What is the difference between ephemeral state and app state?
Ephemeral state belongs to one widget and is managed with setState. App state is shared by many parts of the app and needs a solution such as Provider, Riverpod or Bloc.
3. How does Provider work?
Provider wraps InheritedWidget. You place a provider above the widgets that need the data. They read it with context.watch (rebuild on change) or context.read (one time access).
4. Compare Provider, Riverpod and Bloc.
Provider is simple and context-based. Riverpod is independent of the widget tree, safer at compile time and good for async data. Bloc uses events and states with strict separation of logic and UI, which suits large teams.
5. What is the difference between watch and read?
watch subscribes and rebuilds the widget when the value changes, so use it in build. read gets the value once without subscribing, so use it in callbacks.
6. What is an InheritedWidget?
A widget that makes data available to all descendants and rebuilds those that depend on it when the data changes. Theme and MediaQuery are built on it.
7. Why should state be immutable?
Creating a new object for each change makes it easy for frameworks to detect a change and avoids hidden bugs from shared mutable objects.
8. How does navigation work in Flutter?
The Navigator manages a stack of routes. push adds a screen and pop removes it. For URL-based navigation, deep links and the web, packages such as go_router are used.
9. How do you pass data between screens?
Through constructor parameters (best), route arguments, or by returning a value with Navigator.pop(context, value). For shared data use state management.
10. How do you call a REST API in Flutter?
Use the http or dio package, send the request with await, check the status code, decode the JSON with jsonDecode and convert it into model objects.
11. What is a Future and how is it different from a Stream?
A Future gives a single value later. A Stream delivers many values over time. In the UI, use FutureBuilder and StreamBuilder.
12. Why should you not create the Future inside build() for FutureBuilder?
build can run many times, so each rebuild would create a new request and restart the FutureBuilder. Create the Future once in initState or in a state class.
13. How do you store data locally?
shared_preferences for small key-value settings, secure storage for secrets, SQLite (sqflite or Drift) for structured data and Hive or Isar for NoSQL storage.
14. How do you handle errors from the network?
Wrap calls in try and catch, handle timeouts, connection and HTTP status errors, show clear messages with a retry option and never expose raw errors to the user.
15. What does Firebase offer to a Flutter app?
Authentication, Cloud Firestore and Realtime Database, Cloud Storage, Cloud Messaging for push notifications, Analytics, Crashlytics, Remote Config and Hosting.
16. What is the repository pattern?
A class that hides the data source (API, database, cache) behind a simple interface. The UI and state layer ask the repository, which makes code testable and easier to change.
Conclusion
These questions check whether you can build real apps, not only screens. Be ready to explain trade-offs.

